Skip to content

Commit 02fdc2f

Browse files
committed
rename Bucket constructor arg to awsOptions
1 parent 492dcab commit 02fdc2f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

services/queue/src/bucket.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ let assert = require('assert');
99
* options:
1010
* {
1111
* bucket: // S3 bucket to use
12-
* credentials: {
12+
* awsOptions: {
1313
* accessKeyId: // ...
1414
* secretAccessKey: // ...
15+
* ..any other AWS option; see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property
1516
* // --or--
1617
* mock: <obj>, // use mock S3 object
1718
* },
@@ -22,7 +23,7 @@ let assert = require('assert');
2223
let Bucket = function(options) {
2324
assert(options, 'options must be given');
2425
assert(options.bucket, 'bucket must be specified');
25-
assert(options.credentials, 'credentials must be specified');
26+
assert(options.awsOptions, 'awsOptions must be specified');
2627
assert(!options.bucketCDN || typeof options.bucketCDN === 'string',
2728
'Expected bucketCDN to be a hostname or empty string for none');
2829
assert(options.monitor, 'options.monitor is required');
@@ -36,14 +37,14 @@ let Bucket = function(options) {
3637
// Ensure access to the bucket property
3738
this.bucket = options.bucket;
3839
// Create S3 client
39-
if (!options.credentials.mock) {
40+
if (!options.awsOptions.mock) {
4041
this.s3 = new aws.S3(_.defaults({
4142
params: {
4243
Bucket: options.bucket,
4344
},
44-
}, options.credentials));
45+
}, options.awsOptions));
4546
} else {
46-
this.s3 = options.credentials.mock;
47+
this.s3 = options.awsOptions.mock;
4748
}
4849
// Store bucket CDN
4950
this.bucketCDN = options.bucketCDN;

services/queue/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ let load = loader({
8282
setup: async ({ cfg, monitor }) => {
8383
let bucket = new Bucket({
8484
bucket: cfg.app.publicArtifactBucket,
85-
credentials: cfg.aws,
85+
awsOptions: cfg.aws,
8686
bucketCDN: cfg.app.publicArtifactBucketCDN,
8787
monitor: monitor.childMonitor('public-bucket'),
8888
});
@@ -95,7 +95,7 @@ let load = loader({
9595
setup: async ({ cfg, monitor }) => {
9696
let bucket = new Bucket({
9797
bucket: cfg.app.privateArtifactBucket,
98-
credentials: cfg.aws,
98+
awsOptions: cfg.aws,
9999
monitor: monitor.childMonitor('private-bucket'),
100100
});
101101
await bucket.setupCORS();

services/queue/test/bucket_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ helper.secrets.mockSuite(testing.suiteName(), ['aws'], function(mock, skipping)
7474
// Create bucket instance
7575
const bucket = new Bucket({
7676
bucket: cfg.app.publicArtifactBucket,
77-
credentials: cfg.aws,
77+
awsOptions: cfg.aws,
7878
bucketCDN: 'https://example.com',
7979
monitor: await helper.load('monitor'),
8080
});

0 commit comments

Comments
 (0)