Is it possible to define system level environment variables in a local settings.json?

19 Views Asked by At

This is not for launch configurations, these env vars would need to be injected as system env vars when vscode starts.

I want to let users override dev container volume mounts. This has been an open feature request for years: How do I override mounts of the devcontainer.json config for local users with settings.json?

I'm trying to find a workaround and one possible way could be runargs with system level environment variables for example:

"runArgs": [
    "--volume=${env:SOME_ENV_VAR}:/tmp/derps:rw"
],

I can request users set a bunch of system level env vars, but that's annoying and wonky. I'd rather just provide an example: .vscode/settings.json or .code-workspace or user setting.json and say "set these env vars in your local vscode settings".

Can VS Code export system level env vars on startup that would be accessible from .devcontainer/devcontainer.json?

0

There are 0 best solutions below