POC: Add environment variable injection to plugin #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This a proof of concept for the proposal given in #76
Why?
To show the viability of implementing such a change.
How?
Currently this PR parses the new configuration option and adds environment variables to the handler associated with the file. There is no duplication detection / function specific isolation but this should be possible by copying the handlers js file and later on updating the handler config to use the file with the isolated ENV over the shared handler file.
What needs doing still:
In the event this is seen to be a reasonable feature to implement proper environment separation / collection will need to be set up. Beyond that documentation will need to be written preferably with a set of unit tests. If possible support should also be added for python runtimes using the
os.environ
over theprocess.env
variable.Beyond that a few tests need writing for the implementation.
In theory we could use something like https://webpack.js.org/plugins/environment-plugin/ over injecting the env vars ourselves 🤔