0
votes

I've a two web application (php and angular) hosted on azure web app with two slots (staging and production).

I want swap the two slots (usually from a staging slot into the production slot) . but when i do the swap , the production swap will keep the variable of staging slot ( if the staging point to a test database, when swap, the production slot will point to the test database)

So, any idea to externalize variables to make the application read the value from externaly ?

Thanks

1
where and how i can set the variable in azure web app ?Quentin Merlin
Set Application Settings in Configuration page on portal. It should be swapped like the doc said: docs.microsoft.com/en-us/azure/app-service/…Doris Lv
i can't use variable in js fileQuentin Merlin
Sorry for the delay, you could check if my answer help or not.Doris Lv

1 Answers

1
votes

Sorry for the misunderstanding and the delay, I found an answer for react app.

Like the React client side project, process.env cannot read any azure environment variables on Angular project.

I tested using .env file and env.js file, which all failed. Here is the article I was following, you could have a test: https://www.jvandemo.com/how-to-use-environment-variables-to-configure-your-angular-application-without-a-rebuild/

My last suggestion is hard-code and make several environmental files to match each of your environments.

For more information about the environmental file, see Environment Variables in Angular