Skip to content

Commit 54d15b6

Browse files
authored
Merge branch 'v1' into seeding
2 parents 3498fea + 88aa25f commit 54d15b6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,4 @@ Now your local DynamoDB database will be automatically started before running `s
175175
* [NPM Registry](https://www.npmjs.com/package/serverless-dynamodb-local)
176176

177177
## License
178-
[MIT](LICENSE)
178+
[MIT](LICENSE)

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ServerlessDynamodbLocal {
99
constructor(serverless, options) {
1010
this.serverless = serverless;
1111
this.service = serverless.service;
12+
this.config = this.service.custom && this.service.custom.dynamodb || {};
1213
this.options = options;
1314
this.provider = "aws";
1415
this.commands = {
@@ -94,15 +95,15 @@ class ServerlessDynamodbLocal {
9495
}
9596

9697
dynamodbOptions() {
97-
const config = this.service.custom.dynamodb || {};
98-
const port = config.start && config.start.port || 8000;
98+
const { config } = this;
99+
const port = _.get(config, 'start.port', 8000):
99100
const dynamoOptions = {
100-
endpoint: "http://localhost:" + port,
101+
endpoint: `http://localhost:${port}`,
101102
region: "localhost",
102103
accessKeyId: "MOCK_ACCESS_KEY_ID",
103104
secretAccessKey: "MOCK_SECRET_ACCESS_KEY"
104105
};
105-
106+
106107
return {
107108
raw: new AWS.DynamoDB(dynamoOptions),
108109
doc: new AWS.DynamoDB.DocumentClient(dynamoOptions)
@@ -137,6 +138,7 @@ class ServerlessDynamodbLocal {
137138
}
138139

139140
startHandler() {
141+
const { config } = this;
140142
const config = this.service.custom.dynamodb;
141143
const options = _.merge({
142144
sharedDb: this.options.sharedDb || true
@@ -195,4 +197,4 @@ class ServerlessDynamodbLocal {
195197
});
196198
}
197199
}
198-
module.exports = ServerlessDynamodbLocal;
200+
module.exports = ServerlessDynamodbLocal;

0 commit comments

Comments
 (0)