-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Ability to override env vars from outside of application (container) #9965
Labels
Comments
rtemb
changed the title
Ability to override env vars from outside on application (container) startup
Ability to override env vars from outside on application (container)
Oct 30, 2020
rtemb
changed the title
Ability to override env vars from outside on application (container)
Ability to override env vars from outside of application (container)
Oct 31, 2020
This was referenced Nov 18, 2020
This was referenced Dec 17, 2020
Open
This was referenced Sep 15, 2021
This was referenced Apr 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your proposal related to a problem?
I faced the issue that there is no standard way to override env vars which a react app uses on the Docker container startup a step.
Example:
REACT_APP_API_URI
env var which stores the path to back-end API.build
step which builds my js code to a compressed production version.docker-build
) I use compressed code from the previous step to build a lightweight Nginx-based docker container.Staging
andProduction
. Of course, each environment has its own backend with a different API URI. So, I want to run two instances of the same container but with different REACT_APP_API_URI env var:But it is will be impossible to do because JS code are already built.
It's the only way to do a similar (but not the same) thing is to set
REACT_APP_API_URI
var onbuild
CI step. But, in this case, the value will becompiled
into docker container and I will not be able to override it by passing-e
option todocker run
command.To somehow deal with it I have to build two actually the same containers but with different
REACT_APP_API_URI
values but it is not convenient and violates actually 12 factors app principles.I solved this problem by the way described in this article: https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/.
The solution from the article gave me only one container and the possibility to override env variables by using
-e
option.Describe the solution you'd like
Why you can't just add some similar functionality in form of a build option, plugin, or probably official tool which gives us a standard way to override env vars from outside?
Additional context
I'm not a frontend developer, so sorry if I'm missing something
The text was updated successfully, but these errors were encountered: