Injecting secrets with doppler run

When using doppler run, only printenv shows secrets. Accessing environment variables with $VARIABLE doesn’t work.

Hi @kartikye :wave:

This is happening because the $VARIABLE is getting processed in the current shell, not in the process that doppler run creates.

You’ll need to use the --command form instead, e.g. performing a curl request using Basic Authentication:

doppler run --command='curl -u $USER:$TOKEN https://example.com'

Or if you’re wanting to use a single secret in a command, you can use a sub-shell:

echo "The current project is $(doppler secrets get DOPPLER_PROJECT --plain)"

This is covered in our CLI install documentation for future reference.