Does Pants (in some way/shape/form) consume dotenv...
# general
w
Does Pants (in some way/shape/form) consume dotenvs (https://www.npmjs.com/package/dotenv, https://pypi.org/project/python-dotenv/)? Use case is that I have several .env files for local/dev/rc/prod cases, and I'd like to build
pex
packages for each env for easier distribution. Currently, I need to add a file/resource and capture the .envs to send them along, or I can manually write my .env parameters in pants.toml or the target - but I'm not committing any of those values
👀 1
Possibly related to the local environment/environment-preview stuff?
c
I know
scie-pants
does pick up
.env
files…
w
Hmm, not sure how that would work for pacakging though
c
no, true..
w
So, for example - I have fastapi in a pex, but that relies on a .env file (or just exposing an environment in general). My hope was to automagically read an appropriate .env file (e.g. .env.production) and have those values injected into the PEX (or wherever)
I'm guessing that's the way, just curious if those can be populated from a .env
c
think this passage “setting environment variables and executable search paths” is for the pants execution env, not your built pex 😉
w
Ah, okay - that may be it. I'll give that
env
a shot and see what happens. Thanks!
c
related is that you now also have
env()
support in your BUILD files…
but guess it could be nice with proper
.env
support too…
w
Hmm, didn't work - weird
Rather, it "worked", but something's going funny at runtime
c
😮
w
So strange, I see the environment vars, but the app isn't picking them up. Need to see if there is an issue with the ASGI runner