@@ -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