Skip to content

Commit 1a76730

Browse files
Merge pull request #74 from VertekCorp/master
add support for AWS credential profile
2 parents f8bc40c + ad02188 commit 1a76730

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ The AWS secret for the user that has the ability to upload to the `bucket`. This
7676

7777
*Default:* `undefined`
7878

79+
### profile
80+
81+
The AWS profile as definied in ~/.aws/credentials. If this is left undefined, the normal [AWS SDK credential resolution][7] will take place.
82+
83+
*Default:* `undefined`
84+
7985
### bucket (`required`)
8086

8187
The AWS bucket that the files will be uploaded to.

lib/s3.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,15 @@ module.exports = CoreObject.extend({
2929
this._super();
3030
var plugin = options.plugin;
3131
var config = plugin.pluginConfig;
32+
var profile = plugin.readConfig('profile');
3233

3334
this._plugin = plugin;
35+
36+
if (profile && !this._plugin.readConfig('s3Client')) {
37+
this._plugin.log('Using AWS profile from config', { verbose: true });
38+
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: profile });
39+
}
40+
3441
this._client = plugin.readConfig('s3Client') || new AWS.S3(config);
3542
},
3643

0 commit comments

Comments
 (0)