-
Is there any way to dynamically set environment variables? In my use case, I want to set a secret variable dynamically using a command that takes in another env var for the secret key/name. [tool.hatch.envs.default.env-vars]
SECRET_KEY="some-key-name"
SECRET="$(get-secret $SECRET_KEY)" # get-secret is a placeholder command The only way I can think of is to set it in scripts. [tool.hatch.envs.default.scripts]
test="SECRET=$(get-secret $SECRET_KEY) printenv" ...which does not scale, unless you can use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hatch doesn't preserve exports because it's a different process for each command but you can instead do shell syntax like I will think of a way to support dynamic environment variables based on the output of commands, thanks! Please create an issue/feature request for that. |
Beta Was this translation helpful? Give feedback.
Hatch doesn't preserve exports because it's a different process for each command but you can instead do shell syntax like
test=["secret && stuff"]
.I will think of a way to support dynamic environment variables based on the output of commands, thanks! Please create an issue/feature request for that.