Hi Pranav and welcome to the Doppler community!
While we don’t have official docs for VS Code yet (which I will start working on shortly), here are some tips for making it as easy as possible to work with.
Step 1. Edit your devcontainer.json file to add a containerEnv
field:
{
...
"containerEnv": {
"DOPPLER_TOKEN": "${localEnv:DOPPLER_TOKEN}"
},
...
}
Step 2. Exit VS Code
Step 3. Launch VS code from the terminal with the DOPPLER_TOKEN
env var is set:
DOPPLER_TOKEN=$(doppler configure get token --plain) code ~/your-project-here
Step 4. VS Code should pick-up that you’ve changed the devcontainer.json
and should offer to rebuild it, which you need to do.
Step 5. Now with the dev container rebuilt, you should now have the $DOPPLER_TOKEN
set inside the container and can use doppler run
like you would normally.
If launching VS Code using the DOPPLER_TOKEN=$(doppler configure get token --plain) code ~/your-project-here
approach is a bit kludgy, here is another option which exposes the Doppler CLI token without needing to launch VS Code from the terminal.
Step 1. Expose your Doppler CLI (personal) token in your .bashrc
or .bash_profile
. We name this DOPPLER_CLI_TOKEN
so it doesn’t affect Doppler in your local development environment.
export DOPPLER_CLI_TOKEN=$(doppler configure get token --plain)
Step 2. Edit your devcontainer.json
file to add a containerEnv
field, mapping DOPPLER_TOKEN
to the DOPPLER_CLI_TOKEN
:
{
...
"containerEnv": {
"DOPPLER_TOKEN": "${localEnv:DOPPLER_CLI_TOKEN}"
},
...
}
Let me know how this works out for you.