Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Automatically source env on terminal open in VSCode #285

Open
clouedoc opened this issue Nov 16, 2021 · 5 comments
Open

[FEATURE] Automatically source env on terminal open in VSCode #285

clouedoc opened this issue Nov 16, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@clouedoc
Copy link

clouedoc commented Nov 16, 2021

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 clouedoc added the enhancement New feature or request label Nov 16, 2021
@clouedoc clouedoc changed the title [FEATURE] [FEATURE] Automatically source env on terminal open in VSCode Nov 16, 2021
@YarikRevich
Copy link

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.

@ryan-blunden
Copy link
Contributor

@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?

@clouedoc
Copy link
Author

@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

@Piccirello
Copy link
Contributor

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).

@clouedoc
Copy link
Author

clouedoc commented Aug 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants