Hey! I suspect that I get wrong Pants. I have a .e...
# general
s
Hey! I suspect that I get wrong Pants. I have a .env within my microservice directory that I would like to load, I am using load_dotenv but the function does not seems to work as it cannot find the .env file. That's why I added a resource target, like the following resource(name="env_config", source=".env") and provided a dependency within my python_sources target. But it did not seem to work. What I am missing ?
βœ… 1
c
Hi! is your
.env
file within your source root?
s
yes
c
verify with
pants peek
that the dependency worked, and you can run with
--keep-sandboxes=always
to inspect the files pants actually puts there to see if it is in an unexpected location, if at all..
s
it seems like files with only suffix (e.g .env) cannot be loaded into pants, I had to change the name of the file (e.g prod.env) to make it work
c
oh, right. It’s covered by the default ignore pattern: https://www.pantsbuild.org/docs/reference-global#pants_ignore
πŸ’― 1
you can allow it with:
Copy code
[GLOBAL]
pants_ignore.add = ["!.env"]
s
Thanks! works πŸ™‚
πŸ‘ 1