diff --git a/README.md b/README.md index 8b13fca..79eb817 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ var greenlock = Greenlock.create({ ``` +If using credentials from Environment variables, the shared credentials file, the ECS credentials provider (if applicable), or loaded from AWS IAM using the credentials provider of the Amazon EC2 instance (if configured in the instance metadata), omit the `accessKeyId` and `secretAccessKey`. + ## Testing The strategy is tested against the [greenlock-store-test](https://git.coolaj86.com/coolaj86/greenlock-store-test.js) diff --git a/lib/aws.js b/lib/aws.js index 76bcac2..689d3b9 100644 --- a/lib/aws.js +++ b/lib/aws.js @@ -1,12 +1,14 @@ const AWS = require("aws-sdk"); AWS.config.setPromisesDependency(Promise); -module.exports = (options) => { +module.exports = options => { + AWS.config.update({ region: options.bucketRegion }); + if (options.accessKeyId != null && options.secretAccessKey != null) { AWS.config.update({ - region: options.bucketRegion - , credentials: new AWS.Credentials({ - accessKeyId: options.accessKeyId - , secretAccessKey: options.secretAccessKey - }) + credentials: new AWS.Credentials({ + accessKeyId: options.accessKeyId, + secretAccessKey: options.secretAccessKey + }) }); -} \ No newline at end of file + } +}; diff --git a/package-lock.json b/package-lock.json index a531358..c434c45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "greenlock-storage-s3", - "version": "1.0.0", + "version": "1.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 989698c..27ef0e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "greenlock-storage-s3", - "version": "1.1.3", + "version": "1.1.4", "description": "S3 backed storage strategy for greenlock-express.js (and greenlock.js)", "main": "index.js", "scripts": {