Skip to content

Commit 07573e1

Browse files
committed
add provider based region support
1 parent 99f2b43 commit 07573e1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

shared/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
this.options.stage = _.get(this, 'options.stage')
99
|| 'dev';
1010
this.options.region = _.get(this, 'options.region')
11+
|| _.get(this, 'serverless.service.provider.region')
1112
|| 'us-central1';
1213

1314
return BbPromise.resolve();

shared/utils.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,17 @@ describe('Utils', () => {
3131
expect(googleCommand.options.region).toEqual('my-region');
3232
});
3333
});
34+
35+
36+
it('should set the provider values for stage and region if provided', () => {
37+
googleCommand.serverless.service.provider = {
38+
region: 'my-region',
39+
};
40+
41+
return googleCommand.setDefaults().then(() => {
42+
expect(googleCommand.options.region).toEqual('my-region');
43+
});
44+
});
45+
3446
});
3547
});

0 commit comments

Comments
 (0)