casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
21.78k stars 485 forks source link

how to load environment variables from a secrets manager ? #1540

Open Geczy opened 1 year ago

Geczy commented 1 year ago

currently i always have to do:

doppler run -- just <command>

i would like to just do:

just <command>

and somewhere in the justfile it will load the doppler variables, how can i do this?

https://github.com/dotabod/backend/blob/master/justfile

related: https://github.com/casey/just/issues/945#issuecomment-1126410263

runeimp commented 1 year ago

You should be able to setup your command in question in a hidden recipe and have a public recipe call it with the integration environment

# Public Integration Recipe
command:
    doppler run -- just _command

# Hidden Actual Recipe
_command:
    # all the code...
cortopy commented 1 month ago

unfortunately that doesn't work me.

just command gives me Doppler Error: Invalid Auth token. However if I type doppler run -- just _command in the terminal it works fine

casey commented 1 month ago

I wish we had a general solution for these kinds of thing. This is an instance of the more general problem that you cannot run a command which exports variables, and then have those variables exported to your just recipes.

In this case, can you have doppler export secrets to a .env file, which just then loads?