Launch.json and node application settings

When hosting a node application in Azure I will often set application settings and keys in the portal using the application settings UI.

In my app I retrieve a variables using the env object e.g.


It's then a question on how to add these application settings to your app when debugging locally. My current favourite way to do this is to use the

file in VS Code. You can configure your debugging experience in many ways using this file and easily add env settings as you can see below:

    "version": "0.2.0",
    "configurations": [
            "type": "node",
            "request": "launch",
            "name": "Beebs Bot",
            "program": "${workspaceRoot}/src/app.js",
            "env": {
                "NODE_ENV": "development",
                "MICROSOFT_APP_ID": "obs-fake-3543-543-4353",
                "MICROSOFT_APP_PASSWORD": "6765jjhjh",
                "KNOWLEDGE_BASE_ID": "665756-78678-876867-76876",
                "KNOWLEDGE_BASE_SUBSCRIPTION_KEY": "fake2342342342",
                "LUIS_MODEL_URL": ""

Published by thebeebs

Martin works for Oracle as a Developer Evangelist. He’s been a developer since the late 90s and loves figuring out problems and experimenting with code. Read more