localstack / serverless-localstack

⚡ Serverless plugin for running against LocalStack
511 stars 82 forks source link

implement usage of aws_endpoint_url #243

Closed pinzon closed 4 months ago

pinzon commented 5 months ago

Motivation

This PR optimizes the plugin by utilizing the AWS_ENDPOINT_URL environment variable as per the readme instructions. All default configuration values now derive from this variable, with a default value set to https://localhost.localstack.cloud:4566.

Notes

Currently there are three conflicting ways the protocol, hostname and port are set up:

I propose that in the future it should only support AWS_ENDPOINT_URL env variable and also a new config attribute awsEndpointUrl.

joe4dev commented 4 months ago

So we may need to add localhost.localstack.cloud here as well. /cc @joe4dev could we get your input here? 🙏

✅ This should not be necessary because localhost.localstack.cloud always resolves to IPv4 (at least with our current DNS entry). That's what I get on macOS:

nslookup localhost.localstack.cloud
Server:     1.1.1.1
Address:    1.1.1.1#53

Non-authoritative answer:
Name:   localhost.localstack.cloud
Address: 127.0.0.1

⚠️ However, I think changing the default to localhost.localstack.cloud is a breaking change and should not be done in isolation because it breaks in environments with DNS rebind protection => let me clarify in a review ...

steffyP commented 4 months ago

Thanks for your input @joe4dev 🙏

@pinzon: I would suggest we set the DEFAULT_AWS_ENDPOINT_URL to http://localhost:4566 (like it's also documented in the README), and revisit this when we do the next major release. Then we can also try to adjust this across integrations like @joe4dev suggested.

Regarding the code formatting: I think we can do this in a follow-up PR, it would indeed be nice to have formatting rules, and a pre-commit hook 😄