-
Notifications
You must be signed in to change notification settings - Fork 80
Adding Dynamic Path Override #49
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
Adding Dynamic Path Override #49
Conversation
Lol, funny we both submit a PR for the same thing the same day :-) #50 |
@Hans-Seek |
@taylorreece |
Will add that into the readme, good point actually.
Will change it to |
…dding greedy to readme
I imported these changes last night and verified that they:
|
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.
@Hans-Seek @taylorreece
works as expected and the code is no problem from my view 👍
Thanks!
🎉 This PR is included in version 1.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
We recently faced a problem with the serverless proxy integration, namely when the s3 has a couple of folders and the folders should be mapped via path parameters. We found out that the solution to this would be to slightly adjust this plugin (by making the path override dynamic with fallback to the default functionality)
The main change was made in
lib/package/s3/compileMethodsToS3.js
:This will allow paths like
{folder}/{subfolder}/{item}
to be mapped to an s3 endpoint like for example{folder}/{subfolder}/{item}.xml
For example if the API Gateway gets called with
function/english/data
it will look for the file in s3 at the following point:{bucket}/function/english/data.xml
It can easily be adjusted via
serverless.yml
by adding the pathoverride attribute (string) to a s3 object. I also added these details into theReadme.md
into the S3 section. Please let me know about your thoughts and also let me know if anything needs to be changed/verified before it could be considered to be merged into the plugin.