2
votes

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.

1

1 Answers

1
votes

You can check the documentation below:

https://create-react-app.dev/docs/adding-custom-environment-variables/#adding-development-environment-variables-in-env

.env files 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:

enter image description here

In addition, you can refer to the following case for more suggestions:

How to use environment variables in React app hosted in Azure