Skip to content

Commit 8862c80

Browse files
committed
Moved config loading from constructor to methods
This allows variables to be passed in to the plugin
1 parent 0a154a8 commit 8862c80

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class ServerlessDynamodbLocal {
1010
this.serverless = serverless;
1111
this.service = serverless.service;
1212
this.serverlessLog = serverless.cli.log.bind(serverless.cli);
13-
this.config = this.service.custom && this.service.custom.dynamodb || {};
1413
this.options = options;
1514
this.provider = "aws";
1615
this.commands = {
@@ -102,13 +101,13 @@ class ServerlessDynamodbLocal {
102101
}
103102

104103
get port() {
105-
const config = this.config;
104+
const config = this.service.custom && this.service.custom.dynamodb || {};
106105
const port = _.get(config, "start.port", 8000);
107106
return port;
108107
}
109108

110109
get host() {
111-
const config = this.config;
110+
const config = this.service.custom && this.service.custom.dynamodb || {};
112111
const host = _.get(config, "start.host", "localhost");
113112
return host;
114113
}
@@ -155,7 +154,7 @@ class ServerlessDynamodbLocal {
155154
}
156155

157156
startHandler() {
158-
const config = this.config;
157+
const config = this.service.custom && this.service.custom.dynamodb || {};
159158
const options = _.merge({
160159
sharedDb: this.options.sharedDb || true
161160
},

0 commit comments

Comments
 (0)