-
Notifications
You must be signed in to change notification settings - Fork 633
MAINT CONTROVERSIAL: Make env files configurable #1253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAINT CONTROVERSIAL: Make env files configurable #1253
Conversation
|
So if I provide them with the arg it overrides any auto-detected ones. But what if I provide just .env via arg and .env.local from the directory? There are so many cases 🤷🏻♂️ or a completely different one like .env.roman? Hmm maybe being explicit is preferable? |
If you supply any to initialize_pyrit, those are the only So imagine you have to specify or set them yourself; this is close to how we used to do it. In the past people would load their own environment beforehand.
|
romanlutz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should document the behavior in some way. Perhaps in the .env_example file as well. I'm happy with where you landed in terms of code changes, though! Thanks for hearing me out on the many concerns 😆
This PR updates how
initialize_pyrit_asyncloads environment files, adding support for explicitly specifying.envfiles while making default loading behavior stricter and more predictable.Environment Variable Precedence (lowest to highest priority)
env_filesargument is provided, PyRIT attempts to load~/.pyrit/.envand~/.pyrit/.env.local(if they exist). Values in these files override system environment variables.env_filesis passed toinitialize_pyrit_async, only those files are loaded (default paths are ignored). Later files in the sequence override earlier ones.