Does anyone know how to access environment variabl...
# general
f
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
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
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
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
Tried both. they both work! yay!!
❤️ 1
Thank you so much