Loading secrets from .env in the development environment#57
Open
Loading secrets from .env in the development environment#57
Conversation
Contributor
Author
|
The proof that the prior mix task is too busy: We were already loading the environment variables with a custom script. I prefer to use a dependency focused on that problem instead of doing it by hand. It is outside the scope of this PR, but I think it's a good idea to break down that big mix task into separate tasks. For instance, we could have different modules focused on various problems and a single post_start task that merely orchestrates the work to be done. We're close to that, but the file is too busy, to the point that I forgot about an implementation I made a few days ago. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR will resolve #10
Setting environment variables at build-time
We have variables baked into the dev container that aren't secrets at build-time. They are available for anyone to consume and leverage within their development container. Think of the environment configuration that one might need to have something work as they anticipate but doesn't provide any tangible sensitive information away.
Setting environment variables at run-time
We're specifying to the development container to pull environment variables set on the host's machine and pulling them on the fly for the container to use. For instance, we could think of API key, database credentials or tokens of any kind.
Such as doing something akin to this in the
devcontainer.jsonValues are passed down to the container at runtime instead of build time. The container will only receive these values at the moment it starts. This ensures that they're not written in any of the container's layers and kept out of source control through the .gitignore., making it harder for malicious users to extract secrets from the setup.
This is just for the development environment. We would need a more robust system for the production environment to handle secrets and pull the information from that location.