Hi all. I’m trying to figure out how to use secrets from my Vault on a per-Environment basis. I’d like to re-make the case that this should be a 1st-class feature and not a hacky workaround.
I know this workaround exists. But with the greatest respect to @oliviercuyp, that’s what it is: a workaround. It really shouldn’t be necessary and adds unnecessary complexity.
My use-case
I use Clerk’s Backend API. There’s a single endpoint and you hit Dev or Prod depending on the value of your CLERK_SECRET_KEY which begins sk_test… or sk_prod… – a very common pattern.
It seems obvious that I would like to:
- Configure a single Collection for this API.
- Store my secret Prod key in the Vault.[^0]
- Use the Environments feature, defining
CLERK_SECRET_KEYas a variable in each, and using the{{vault:_}}value. - And now just use my Collection, switching Environment as required.
And no, I don’t want 2 Collections. I configure each API call with, say, JSON in the body. For example, adding user metadata to a create invitation call. Multiple collections is now multiple places to keep that updated, and an opportunity to make a mistake.
I rest my case.
[^0]: This key being very secret to me. I store it in 1Password and use their integration to inject it in to my environment. The only place I trust it to be in Postman is in the Vault. You get it, you get all my users.