@@ -9,6 +9,7 @@ class ServerlessDynamodbLocal {
9
9
constructor ( serverless , options ) {
10
10
this . serverless = serverless ;
11
11
this . service = serverless . service ;
12
+ this . config = this . service . custom && this . service . custom . dynamodb || { } ;
12
13
this . options = options ;
13
14
this . provider = "aws" ;
14
15
this . commands = {
@@ -94,15 +95,15 @@ class ServerlessDynamodbLocal {
94
95
}
95
96
96
97
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 ) :
99
100
const dynamoOptions = {
100
- endpoint : " http://localhost:" + port ,
101
+ endpoint : ` http://localhost:${ port } ` ,
101
102
region : "localhost" ,
102
103
accessKeyId : "MOCK_ACCESS_KEY_ID" ,
103
104
secretAccessKey : "MOCK_SECRET_ACCESS_KEY"
104
105
} ;
105
-
106
+
106
107
return {
107
108
raw : new AWS . DynamoDB ( dynamoOptions ) ,
108
109
doc : new AWS . DynamoDB . DocumentClient ( dynamoOptions )
@@ -137,6 +138,7 @@ class ServerlessDynamodbLocal {
137
138
}
138
139
139
140
startHandler ( ) {
141
+ const { config } = this ;
140
142
const config = this . service . custom . dynamodb ;
141
143
const options = _ . merge ( {
142
144
sharedDb : this . options . sharedDb || true
@@ -195,4 +197,4 @@ class ServerlessDynamodbLocal {
195
197
} ) ;
196
198
}
197
199
}
198
- module . exports = ServerlessDynamodbLocal ;
200
+ module . exports = ServerlessDynamodbLocal ;
0 commit comments