99x / dynamodb-localhost

Dynamodb localhost runner for development and testing
MIT License
35 stars 92 forks source link

Update config port hierarchy to look at .yml file first before comman… #19

Closed lucasklaassen closed 3 years ago

lucasklaassen commented 6 years ago

What did you implement:

Closes: https://github.com/99xt/serverless-dynamodb-local/issues/135

How did you implement it:

I swapped the order of the port configuration so that it first checks to see if you've defined a port within your serverless.yml file rather than if you've passed one in via the command line.

This may or may not be an issue for people who are currently using this plugin. My line of thinking was that if they are passing a port through the command line today, it will be setting their localhost server which hosts their api gateway endpoints on the same port. (which will error) Not everyone uses API Gateway so there could be some cases out there that this doesn't apply to. If someone is running multiple dynamoDB databases and they are using the --port command line flag to specifically define a port, is there a use case where they would need to set a port within their serverless.yml file?

Documentation updates pertain to: https://github.com/99xt/serverless-dynamodb-local/blob/v1/README.md#install-sls-dynamodb-install

Start: sls dynamodb start

All CLI options are optional:

--port            -p  Port to listen on. Default: 8000. This flag is overridden by the serverless.yml custom option detailed below.

All the above options can be added to serverless.yml to set default configuration: e.g.

custom:
  dynamodb:
    start:
      port: 8000 # This option will override the CLI option --port
      inMemory: true
      migrate: true
      seed: true
    # Uncomment only if you already have a DynamoDB running locally
    # noStart: true

Todos:

Is this ready for review?: YES Is it a breaking change?: MAYBE for some users.

xeonarno commented 5 years ago

Can you pull this feature please. It's create enormous problem with it !!!! this is awesome and deeply required please !