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

full-ocean-15873

04/20/2022, 7:57 PM
Does anyone know how to access environment variables in the pants.toml for a index url? I need to access creds for a private pypi repo
Copy code
[python-repos]
indexes.add = []
1
1
my format is
https://<user>:<password>:<http://test.com|test.com>
h

hundreds-father-404

04/20/2022, 8:03 PM
added in https://github.com/pantsbuild/pants/pull/15087 in 2.12! In the meantime, you can use a .pantsrc config file in your project or use environment variables https://www.pantsbuild.org/docs/options#environment-variables
f

full-ocean-15873

04/20/2022, 8:04 PM
what is the .pantsrc file?
and still not clear on the pants environment variable access. I did name my environment variables as
PANTS_<system_name>_USER
Will that not work?
h

hundreds-father-404

04/20/2022, 8:08 PM
re env var: you can set `PANTS_PYTHON_REPOS_INDEXES="+[\"foo.bar.{SOME_ENV_VAR}\"]" Does that make sense?
See https://www.pantsbuild.org/docs/options#pantsrc-file for .pants.rc. The idea is that you would have each developer hardcode the value you want in that file You can add it to gitignore, so you don't have the security concerns
Or, again, your third option is to use pants 2.12 and that new feature
f

full-ocean-15873

04/20/2022, 8:19 PM
Tried both. they both work! yay!!
❤️ 1
Thank you so much