Allow use of IAM instance profile credentials
This commit is contained in:
parent
6c0ea5704e
commit
1f240543c8
|
@ -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)
|
||||
|
|
12
lib/aws.js
12
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
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "greenlock-storage-s3",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.4",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Reference in New Issue