Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
Former Member
4 years agoAllow defaults to be specified, or env not to be set, if vault or slot not found with op run
I'm using op run combined with a .env file to load our development configuration, but we have quite a bit of optional configuration. Some devs may need part of the config, other devs might need other...
Former Member
3 years agoThanks for the comment, but not sure this helps, unless I'm misunderstanding something.
If I have a line in my .env file like this:
DB_USERNAME="op://${OP_VAULT:-dev}/db/username"
how would I make it so the DB_USERNAME was set to "jonb1" (for instance) if the vault doesn't exist?
In this case I get [ERROR] 2023/01/02 19:32:10 could not resolve item UUID for item db
Something like this:
DB_USER_NAME="${op://dev/db/username:-jonb1}"
gives expected character ':' and op://dev/db/username isn't really a VAR_NAME anyway.
It's not that I want a default value for an variable, but a default value if the resolution of the vault/slot/attribute doesn't work for some reason.