Hi pants experts, I'd like your suggestion on how ...
# general
p
Hi pants experts, I'd like your suggestion on how to store environment variables and their values when building a PEX file. I guess I can do "my_env=somevalue my_pex" when running the pex file, but this doesn't scale in my case where I need to set tons of env variables. I see a relevant open issue https://github.com/pantsbuild/pants/issues/10352, so I assume this is not yet supported? Thanks
h
Hi, it sounds like you're trying to "bake" env var values into the pex file so that they are set at its runtime? That issue is about something else - setting env vars to control how arbitrary processes work.
So the goal is to set env vars at build time that get embedded in the pex file and appear in its environment at runtime?
What is an example of this?
p
Hi Ben - yes this is exactly what I am looking for
I am building a pex that is bundled with apache-airflow and a few relevant dependencies so that I can use pex to run a DAG locally. There are many env variables that are needed for credentials, airflow runtime configs, etc
e
That's a Pex feature that does not exist yet @powerful-florist-1807: https://github.com/pantsbuild/pex/issues/987
👍 1
p
Thanks John and this is great to know! It seems the workaround is to manually run a script to set all the env variables before executing the PEX file. I am looking forward to a contribution for this issue.