Visual Studio Code env vars
This is documented but, for some reason, I always forget it.
Visual Studio Code is awesome and, in particular when debugging, it’s useful to set environment variables.
I write a lot of Google Cloud code and so I’m frequently wanting:
launch.json:
{
"version": "0.2.0",
"configurations": [
{
...
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "...",
"PROJECT": "...",
}
}
]
}
And, through a combo of forgetfulness and laziness, I tend to duplicate the values from the host environment as strings in these files.
But, as documented, you don’t need to do that and you can have Code duplicate it’s (host’s) environment variables in its debugger:
{
"version": "0.2.0",
"configurations": [
{
...
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "${env:GOOGLE_APPLICATION_CREDENTIALS}",
"PROJECT": "${env:PROJECT}",
}
}
]
}