File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ custom:
6767 seed: true
6868 # Uncomment only if you already have a DynamoDB running locally
6969 # noStart: true
70+ # If you only want to start DynamoDB in some stages, declare them here
71+ stages:
72+ - dev
7073` ` `
7174
7275# # Migrations: sls dynamodb migrate
Original file line number Diff line number Diff line change @@ -182,9 +182,16 @@ class ServerlessDynamodbLocal {
182182 this . options
183183 ) ;
184184
185+ const stage = options . stage || this . serverless . service . provider . stage
186+ let startThisStage = true ;
187+ if ( options . stages && ! options . stages . includes ( stage ) ) {
188+ startThisStage = false ;
189+ }
190+ options . startThisStage = startThisStage
191+
185192 // otherwise endHandler will be mis-informed
186193 this . options = options ;
187- if ( ! options . noStart ) {
194+ if ( ! options . noStart && startThisStage ) {
188195 dynamodbLocal . start ( options ) ;
189196 }
190197 return BbPromise . resolve ( )
@@ -193,7 +200,7 @@ class ServerlessDynamodbLocal {
193200 }
194201
195202 endHandler ( ) {
196- if ( ! this . options . noStart ) {
203+ if ( ! this . options . noStart && this . options . startThisStage ) {
197204 this . serverlessLog ( "DynamoDB - stopping local database" ) ;
198205 dynamodbLocal . stop ( this . port ) ;
199206 }
You can’t perform that action at this time.
0 commit comments