diff --git a/README.md b/README.md index c9c80df..97ff2f7 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,23 @@ custom: # noStart: true ``` +Localstack setup: +```yaml +custom: + serverless-dynamodb: + # If you only want to use DynamoDB Local in some stages, declare them here + stages: + - dev + start: + # The port that your localstack is running on + port: 4566 + migrate: true + seed: true + noStart: true + # Beware, region is important for localstack + region: 'eu-west-1' +``` + ### Migrations: serverless dynamodb migrate #### Configuration diff --git a/src/config.ts b/src/config.ts index bc2ac11..a7720c8 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,6 +13,7 @@ export interface Config { host?: string; port?: number; seed?: boolean | string; + region?: string; }, stages?: string[], seed?: SeedConfig; diff --git a/src/index.ts b/src/index.ts index fb3b157..bf83404 100644 --- a/src/index.ts +++ b/src/index.ts @@ -211,7 +211,7 @@ class ServerlessDynamoDBPlugin implements Plugin { } else { dynamoOptions = { endpoint: `http://${this.host}:${this.port}`, - region: 'localhost', + region: this.config?.start?.region ?? 'localhost', credentials: { accessKeyId: 'MockAccessKeyId', secretAccessKey: 'MockSecretAccessKey',