Skip to content

Commit 74825be

Browse files
committed
allow passing any additional AWS.config parameters (not just signatureVersion) via amazon.config
useful for setting up proxies, loggers, retry parameters, etc
1 parent 3e755a2 commit 74825be

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ gulp.task('deploy', function() {
2828
accessKeyId: "< your access key (fyi, the 'short' one) >", // optional
2929
secretAccessKey: "< your secret access key (fyi, the 'long' one) >", // optional
3030
}
31-
signatureVersion: "v4", // optional
31+
config: { // optional
32+
signatureVersion: "v4",
33+
}
3234
region: 'eu-west-1',
3335
bucket: 'elasticbeanstalk-apps',
3436
applicationName: 'MyApplication',

src/plugin.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ export async function deploy(opts, file, s3file, bean) {
189189
* * versionLabel: version. version + currentTimestamp if timestamp was true
190190
* * filename: versionLavel + '.zip'
191191
*
192-
* If the resulting object amazon property contains accessKeyId and
193-
* secretAccessKey, both will be added as `AWS.config.credentials`.
192+
* If the resulting object amazon property contains credentials,
193+
they will be added as `AWS.config.credentials`.
194194
*
195-
* If the resulting object amazon property contains signatureVersion, it will
196-
* be added to `AWS.config`, ese v4 will be used as signatureVersion
195+
* If the resulting object amazon property contains a configuration object,
196+
* it will be applied to `AWS.config`.
197197
*
198198
* @param {Object} opts
199199
* @return {Object}
@@ -232,6 +232,10 @@ export function buildOptions(opts) {
232232
signatureVersion: 'v4'
233233
}, options.amazon.config || {}))
234234

235+
// legacy support for signatureVersion now covered by config parameter
236+
if (options.amazon.signatureVersion)
237+
AWS.config.signatureVersion = options.amazon.signatureVersion
238+
235239
if (options.amazon.credentials !== undefined) {
236240
const creds = options.amazon.credentials
237241
const credsType = typeof(creds)

test/test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,16 @@ describe('Gulp plugin', () => {
551551
AWS.config.signatureVersion.should.be.equal('v4')
552552
})
553553

554-
it('allows to set a signatureVersion for AWS.config', () => {
554+
it('allows to set a signatureVersion for AWS.config (legacy)', () => {
555+
buildOptions({
556+
amazon: {
557+
signatureVersion: 'v2'
558+
}
559+
})
560+
AWS.config.signatureVersion.should.be.equal('v2')
561+
})
562+
563+
it('allows to supply additional paramters to passed into AWS.config', () => {
555564
buildOptions({
556565
amazon: {
557566
config: {

0 commit comments

Comments
 (0)