cli icon indicating copy to clipboard operation
cli copied to clipboard

[FEATURE] Automatically source env on terminal open in VSCode

Open clouedoc opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe.

I wouldn't say that I like typing "doppler run " each time I use my CLI.

Describe the solution you'd like

I would like to have a doppler source command to source environment variables to the local terminal. I would also like to have a VSCode or ZSH integration that would do that for me.

Describe alternatives you've considered

I wrote this command to download and source secrets to the local terminal:

eval $(doppler secrets download --format env --no-file --fallback-only)

I am still wondering how to run a command on each ZSH terminal open.

Final solution for me

I've created an alias that I run each time I want to seed environment variables to the current terminal:

alias denv="eval \$(doppler secrets download --format env --no-file --fallback-only)"

Then, I can call it like this:

denv

Additional context

My IDE is VSCode.

clouedoc avatar Nov 16 '21 21:11 clouedoc

The only solution fixes your issue is to make command "dopler source" return "eval $(doppler secrets download --format env --no-file --fallback-only)" command, which you should then write anyone to the terminal on you own again... because there is no such opportunity to apply env vars to your terminal just calling "dopler env" once.

YarikRevich avatar Jul 19 '22 16:07 YarikRevich

@clouedoc Would creating a VS Code launch configuration that uses the Doppler CLI to run your application be another option?

Could you expand upon why you need the secrets exposed in your shell instead of to specific commands or scripts?

ryan-blunden avatar Aug 17 '22 03:08 ryan-blunden

@ryan-blunden creating a VS Code launch configuration wouldn't be enough since some commands require dynamic input, and it would be a burden to create Launch Configurations each time.

e.g. testing a subportion of the app

clouedoc avatar Aug 17 '22 15:08 clouedoc

We now have a vscode extension that you can use. Alternatively, I would suggest starting a new shell with your secrets injected, rather than injecting them into the existing shell. You can do so using doppler run -- bash (replace bash with your preferred shell).

Piccirello avatar Jun 02 '23 04:06 Piccirello

That's great news! It's making me want to give Doppler another try 😃 . I'll close this issue since it should be "fixed" by the VSCode extension.

clouedoc avatar Aug 09 '23 08:08 clouedoc