Closed danlamanna closed 11 months ago
Not inside crestic, sorry. But you can set a session wide environment variable that way in your .bashrc
.
Do you think it's out of scope for the project? Because I have to set these environment variables differently per backup environment, which doesn't seem too unusual.
Right now I'm inclined to say its beyond the scope, yes. Deciding whether to take a string literally vs execute it sounds like a major headache to solve...
But: I'm already expanding environment variables in all argument string fragments, but not yet in environment variables. It would make sense to harmonize that behaviour and expand env variables everywhere, in options and [*.environ]
sections. I've implemented that behaviour in the envvar-expand
branch, you can go have a look if you like it.
You can then interpolate different variables in different settings, like
[preset_a.environ]
B2_ACCOUNT_ID: <MY_APPLICATION_A_KEY_ID>
B2_ACCOUNT_KEY: $$B2_ACCOUNT_KEY_PRESET_A
[preset_b.environ]
B2_ACCOUNT_ID: <MY_APPLICATION_A_KEY_ID>
B2_ACCOUNT_KEY: $$B2_ACCOUNT_KEY_PRESET_B
or whatever structure you prefer. Note the double dollar sign $$
which is needed because of ConfigParser
internals.
It's now in master
and will be in the next release. Thanks for the suggestion!
Is it possible to set an environment variable using a command? So instead of:
One could use: