Skip to content

Commit d35a7bb

Browse files
authored
Merge pull request #143 from serverless/support-stage-in-provider
Add support for stage definition in provider object
2 parents 48518cf + e179c39 commit d35a7bb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

shared/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const BbPromise = require('bluebird');
55

66
module.exports = {
77
setDefaults() {
8-
this.options.stage = _.get(this, 'options.stage') || 'dev';
8+
this.options.stage = _.get(this, 'options.stage') || _.get(this, 'serverless.service.provider.stage') || 'dev';
99
this.options.runtime = _.get(this, 'options.runtime') || 'nodejs8';
1010

1111
// serverless framework is hard-coding us-east-1 region from aws

shared/utils.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ describe('Utils', () => {
4343
it('should set the provider values for stage and region if provided', () => {
4444
googleCommand.serverless.service.provider = {
4545
region: 'my-region',
46+
stage: 'my-stage',
4647
};
4748

4849
return googleCommand.setDefaults().then(() => {
4950
expect(googleCommand.options.region).toEqual('my-region');
51+
expect(googleCommand.options.stage).toEqual('my-stage');
5052
});
5153
});
5254

0 commit comments

Comments
 (0)