Click here to Skip to main content
15,566,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a node.js application deployed on Azure as "myClient" App Service, and several configuration files which contain values specific to their runtime environment:
- appconfig.json for debugging on localhost (not applicable to Azure).
- appconfig.production.json for running in the App Service production Slot "myClient".
- appconfig.development.json for running in the App Service development Slot "myClient/development".

myClient app contains an "" file:
export const environment = {
    production: true,
    hmr: false,
    appConfig: 'appconfig.development.json'

The app is published with "npm run publish" from DOS shell.
I can upload the package to "myClient/development" Slot and it runs fine with no issues.

When I want to create a package for the "myClient" Production Slot I make the following change to "" file and publish again.
appConfig: 'appconfig.production.json'

The published package is uploaded to Azure Production Slot and it runs fine with no issues.

HERE IS THE PROBLEM with this approach:
- source code must be modified to specify the environment.
- publishing takes 25-30 minutes.
- cannot use Swap Slot feature in Azure.

If I could access an Application Setting (analogous to ASPNETCORE_ENVIRONMENT), I could then select the correct configuration file (in code) based on the environment for that Slot, and then use Swap to deploy from development to production.

Is it possible to reference Azure Configuration Application setting from a node application using javascript?

Is there alternative process to modifying the source code and publishing for each environment?

What I have tried:

I have searched the Internet (including this site) to see if there is a way to access App Service Application Settings from a node application, and have not found any article describing how to accomplish this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900