简体   繁体   中英

How to set azure-web-app-service application settings for node.js app via deployment

Is it possible to set azure app service application settings (especially env variables) via deployment? We are using local git repositories to deploy our NodeJS application to different azure appservices. There are several environment variables required to run the application. I'd like to know if there is a way to insert those automatically while deploying the application so I do not have to set them manually for each application. If its possible how does azure handles changes in the environment settings if I changed a variable afterwords? For example if I have sensitive data that I have to enter after deployment directly into the env variable?

Here's an example. Variables: Name=InitialValue

VAR_1=Test1234
VAR_2=Hello World
USERNAME=
PASSWORD=

USERNAME AND PASSWORD need to be empty an filled afterwords directly via azure portal. Now I redeploy. What happens to my USERNAME and PASSWORD entries? What happens if I change the value of VAR_1? In this case I'd like to have the environment variable changed.

In azure app service the environment variables can be set via Application Settings > App Settings.

It has a 'key-value' format where you can enter the variable name and its value.

Then in the code you can read them as "process.env.Username " and so on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM