Skip to content

Commit 7e41861

Browse files
authored
Merge pull request #160 from kabo/v1
Whitelist stages to run DynamoDB Local
2 parents 2321871 + b95ec9e commit 7e41861

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ All the above options can be added to serverless.yml to set default configuratio
6060
```yml
6161
custom:
6262
dynamodb:
63+
# If you only want to use DynamoDB Local in some stages, declare them here
64+
stages:
65+
- dev
6366
start:
6467
port: 8000
6568
inMemory: true

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ class ServerlessDynamodbLocal {
9595
}
9696
};
9797

98+
const stage = this.options.stage || this.service.provider.stage;
99+
if (this.config.stages && !this.config.stages.includes(stage)) {
100+
// don't do anything for this stage
101+
this.hooks = {};
102+
return;
103+
}
104+
98105
this.hooks = {
99106
"dynamodb:migrate:migrateHandler": this.migrateHandler.bind(this),
100107
"dynamodb:seed:seedHandler": this.seedHandler.bind(this),

0 commit comments

Comments
 (0)