serverless/lib/plugins/aws/lib/validate.js
Erik Erikson bf8d57fa9f Improve Stage and Region Usage
Remove the errant (but understandable) distributed usage of region and stage settings.  This otherwise locks in a multitude of bugs around the improper algorithm for selecting (given all context) the proper region or stage setting.  Instead, all code should use the centralized algorithm for determining such values.  This creates a strange first and second class configuration concept but these two are sufficiently varied and complex in their creation and use that this seems appropriate.
2017-12-11 16:39:44 -08:00

18 lines
403 B
JavaScript

'use strict';
const BbPromise = require('bluebird');
module.exports = {
validate() {
if (!this.serverless.config.servicePath) {
throw new this.serverless.classes
.Error('This command can only be run inside a service directory');
}
this.options.stage = this.provider.getStage();
this.options.region = this.provider.getRegion();
return BbPromise.resolve();
},
};