Reading Azure Application Settings in a Node.js App

Environment Variables and Deployment Slots.

So you’ve recently deployed a Node application to an Azure App Service. Everything is working smooth and now you want to create a deployment slot to host your staging/ pre-production environment.

You want to use separate databases (duh! don’t want to alter production data) for the staging and production environment but don’t want to make changes to the code each time you deploy to staging slot.

The idea here is to make sure that each time you swap your slot, the value for the database connection or any variable that is environment dependent is loaded directly from the environment, thus freeing the user of the hassle to manually alter / edit code during deployment.

Continue reading