I have a React application built using Vite. For local development, I have set up an .env file which contains a VITE_URL variable.
Here is a brief overview of my setup:
Build Tool: Vite
Source Control: GitLab (used to generate a container image for the app)
Hosting: Azure Web Apps (containerized deployment)
Requirement:
I need the VITE_URL variable to change based on the environment (e.g., development, staging, production).
Current Setup:
In Azure Web Apps, I have set up an application setting named VITE_URL, but this value is not being passed into the container.
Problem:
When deploying the application to different environments, the VITE_URL does not update according to the Azure Web Apps configuration.
What Works:
The only solution that works so far is adding a .env.production file with the URL. However, this does not satisfy the requirement because I need to have different URLs based on the deployed environment.
Question:
How can I configure my Azure Web Apps container to pass different VITE_URL values based on the environment?
What I have tried:
Setting VITE_URL as an environment variable in Azure Web Apps.
Confirmed the variable is set in Azure Web Apps configuration settings.
Rebuilding and redeploying the container after setting the environment variable.