https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

09/07/2022, 3:48 AM
Is there a way within
pants.toml
to specify a default for an env var if it's not set in the caller's environment?
It seems like I could potentially get this with interpolation, but I'm not sure how powerful that syntax is.
a

ancient-rose-27306

09/07/2022, 3:54 AM
It depends on which env variable you are looking at here. As for
GLOBAL
scope, you can get a list of variables available to set by running
./pants help-advanced global
h

high-yak-85899

09/07/2022, 3:57 AM
Actually, turns out it doesn't matter for the specific case I was trying to do! I'm using the
[docker].env_vars
and that doesn't care whether env vars are set in the user environment or not.
a

ancient-rose-27306

09/07/2022, 3:58 AM
For Docker, you can set the env variables in Dockerfile itself.
h

high-yak-85899

09/07/2022, 3:59 AM
That's not what I'm trying to do.
I need the
[docker].env_vars
so that the docker invocation is modified with the env vars I want.
This allows me to use the same pants command to push images into my minikube cluster using this method
r

refined-addition-53644

09/07/2022, 6:34 AM
w

worried-painter-31382

09/07/2022, 6:40 AM
I think a
pants.ci.toml
with overrides is what you'd use for CI, a
.pantsrc
for local overrides of the "main"
pants.toml
I.e instead of providing default env values, you create a separate override config that requires those env values, and write the defaults in
pants.toml
h

high-yak-85899

09/07/2022, 4:43 PM
Yeah, makes sense for that use case. Turns out for what I was doing, it's fine if the variables aren't set in the environment with the
env_vars
option.
4 Views