how to load environment variables from a secrets manager ?
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
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...
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
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?
Interested in native solution too.
For now I use following trick around (in Just file):
DBURL_STAGE := "$(shell doppler secrets -p <PROJECT> -c <ENVIRONMENT> get <SECRET> --plain)"
and load all needed secrets same way.
Then in some target:
deploy:
echo "{{DBURL_STAGE}}"
Not very comfortable, but very flexible. I can access few environment ar once.