-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
create pattern construct for a webapp extension #10701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the extension examples, it makes the API so much easier to use. Auto-CORS config is a nice extra as well. 🙌
I tested these changes with the https://github.com/localstack/localstack-extension-event-studio and it works like a charm. 👍
I'm not so familiar with our routing internals and would suggest someone else signing it off, for example @alexrashed or @dfangl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice abstraction, which saves a lot of repetitive code among the different extension implementations, but also helps tackling edge cases in a generic way (f.e. the 301 redirect for relative imports)! 🚀
I think this can be merged as is (after removing the container.py
). 🥳
eff4d80
to
7e1cf6d
Compare
marking this as patch since it is purely additive and affects no existing localstack control paths |
Motivation
Webapp extensions such as:
Follow a common pattern. They
http://my-extension.localhost.localstack.cloud:4566
, andhttp://localhost.localstack.cloud:4566/_extension/my-extension
)my_extension
Their file layout will typically look like this:
This PR introduces this pattern as a class that can be extended to quickly develop extensions like this.
Examples of how existing extensions have been simplified can be found in:
Requires Rolo v0.5.0
Changes
localstack.extension.patterns
WebAppExtension
Testing
If you want to test this you can:
make install
localstack extensions dev enable .
EXTENSION_DEV_MODE=1 python -m localstack.dev.run -e LOCALSTACK_API_KEY=test -e EXTENSION_DEV_MODE=1
TODO
What's left to do: