How to manage deployment stages with env vars
See original GitHub issueDeploy pipelines (test, prod) based on environment vars are important for some apps.
As most static deploy options may not handle the npm run build
by themselves (allowing to register stage specific env vars at design time), I think some README advice on how to manage stage specific env vars would be helpful to many.
Or perhaps an enhancement like
STAGE=MYSTAGE npm run build
which selects the REACT_APP_MYSTAGE_SOMEVAR
env var?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
How To Manage Environment Variables? - Humanitec
How to manage environment variables ? Read the full interview with DevOps Engineer Antoine Rougeot about the fear to break things, ...
Read more >Serverless: Managing environment variables efficiently with ...
I recently started exploring the Serverless framework for managing and deploying our Lambda functions and found it to be extremely powerful.
Read more >How To: Manage Serverless Environment Variables Per Stage ...
Using STAGES and ENVIRONMENT variables together can create a really powerful workflow for you and your development team.
Read more >Setting up stage variables for a REST API deployment
Stage variables are name-value pairs that you can define as configuration attributes associated with a deployment stage of a REST API.
Read more >Environment Variables: What They Are and How To Use Them
You can easily set up .env files in a local development environment. Unlike platform-native variable managers, you do not need to deploy your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @kimcrab, this code block is a set of shell commands and need to be run in the shell/terminal. It should be run before you run commands like
npm run build
Once you export a variable, you can access it in the node environment(where your build scripts written using webpack/grunt/gulp run) using process.env. So above scripts will enable you to access variables usingprocess.env.REACT_APP_BUILD_ENV
Does this help? Happy to connect outside this issue thread in case you need anything else.Thanks @islahul, now I totally understand the point. When I type
export AWS_ACCESS_KEY_ID="XXXXXX"
in terminal, It is just a variable saved inside my terminal and when I typenpm run build
, webpack access to this variable! Very simple but didn’t understand before. I just finished test case and now I know what to do! Thanks again! You saved my day!