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:
67
67
seed: true
68
68
# Uncomment only if you already have a DynamoDB running locally
69
69
# noStart: true
70
+ # If you only want to start DynamoDB in some stages, declare them here
71
+ stages:
72
+ - dev
70
73
` ` `
71
74
72
75
# # Migrations: sls dynamodb migrate
Original file line number Diff line number Diff line change @@ -182,9 +182,16 @@ class ServerlessDynamodbLocal {
182
182
this . options
183
183
) ;
184
184
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
+
185
192
// otherwise endHandler will be mis-informed
186
193
this . options = options ;
187
- if ( ! options . noStart ) {
194
+ if ( ! options . noStart && startThisStage ) {
188
195
dynamodbLocal . start ( options ) ;
189
196
}
190
197
return BbPromise . resolve ( )
@@ -193,7 +200,7 @@ class ServerlessDynamodbLocal {
193
200
}
194
201
195
202
endHandler ( ) {
196
- if ( ! this . options . noStart ) {
203
+ if ( ! this . options . noStart && this . options . startThisStage ) {
197
204
this . serverlessLog ( "DynamoDB - stopping local database" ) ;
198
205
dynamodbLocal . stop ( this . port ) ;
199
206
}
You can’t perform that action at this time.
0 commit comments