Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ The AWS secret for the user that has the ability to upload to the `bucket`. This

*Default:* `undefined`

### profile
The AWS profile as defined in ~/.aws/credentials. If this is left undefined, the normal AWS SDK credential resolution will take place.

*Default:* `undefined`

### bucket (`required`)

The AWS bucket that the files will be uploaded to.
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function _list(opts) {
let archivePrefix = opts.archivePrefix;
let bucket = opts.bucket;
let region = opts.region;
let profile = opts.profile;
let manifestKey = opts.manifestKey

let client = new AWS.S3({
Expand All @@ -20,6 +21,12 @@ function _list(opts) {
region
});

if (profile) {
AWS.config.credentials = new AWS.SharedIniFileCredentials({
profile: profile
});
}

let listObjects = RSVP.denodeify(client.listObjects.bind(client));
let getObject = RSVP.denodeify(client.getObject.bind(client));

Expand Down Expand Up @@ -201,14 +208,15 @@ module.exports = {
let archivePrefix = this.readConfig('archivePrefix');
let bucket = this.readConfig('bucket');
let region = this.readConfig('region');
let profile = this.readConfig('profile');
let manifestKey = this.readConfig('manifestKey');
let awsPrefix = this.readConfig('awsPrefix');

archivePrefix = awsPrefix ? `${awsPrefix}/${archivePrefix}` : archivePrefix;
manifestKey = awsPrefix ? `${awsPrefix}/${manifestKey}` : manifestKey;

let opts = {
accessKeyId, secretAccessKey, archivePrefix, bucket, region, manifestKey
accessKeyId, secretAccessKey, archivePrefix, bucket, region, profile, manifestKey
};

return _list(opts, this)
Expand Down