2

Is it possible to treat app settings in Azure as an object using Node/Express similar to ASP.NET Core?

For example, if my app settings are:

container:value1 = "Hello",
container:value2 = "World"

I'd like to get an object for "container" that gives me:

{
     value1: "Hello",
     value2: "World"
}

I've tried container:value1 and container__value1 like ASP.NET Core, but without luck.

1
  • have you looked at ./config/config.js in the root of your app directory? Commented Feb 21, 2017 at 17:08

1 Answer 1

5

Per Azure's documentation,

App settings

This section contains name/value pairs that your web app will load on start up.

  • For .NET apps, these settings are injected into your .NET configuration AppSettings at runtime, overriding existing settings.
  • PHP, Python, Java and Node applications can access these settings as environment variables at runtime. For each app setting, two environment variables are created; one with the name specified by the app setting entry, and another with a prefix of APPSETTING_. Both contain the same value.

So in Node.js, you can use the following line of code to get Azure App Settings.

process.env['container:value1']
Sign up to request clarification or add additional context in comments.

1 Comment

This works fine and I'll mark it as the answer. But basically it doesn't seem like there's any way to automatically map Azure app settings to a hierarchical object in Node like I can with ASP.NET Core.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.