I developed a pipeline with CI/CD on azure Devops for deploying a React app on Azure web app service. Locally I'm using a .env file and this file is on .gitignore. I want to know how can i set the .env for reading it on production.
Asked
Active
Viewed 2,240 times
1 Answers
1
You can check the documentation below:
.envfiles should be checked into source control (with the exclusion of.env*.local).
If you don't want to check in the .env files to DevOps, you could add the variables in the pipeline variables:
In addition, you can refer to the following case for more suggestions:
How to use environment variables in React app hosted in Azure
Cece Dong - MSFT
- 27,714
- 1
- 20
- 36
-
Have you checked my reply? Does checking in the `.env` file into source control solve your issue? – Cece Dong - MSFT Nov 02 '20 at 09:24
-
While that would technically work, how would you manage this if you had a public repo and didn't want to expose your API key? (assuming you weren't injecting into the Pipeline variables) – yoursweater May 21 '21 at 18:32