-
Notifications
You must be signed in to change notification settings - Fork 452
Override / interpolate of variables working incorrectly #256
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
Comments
Totally agree. This is annoying and will always enforce that the current env defined variable will still be substituted in the .env even if its defined at .env This line should just be reversed python-dotenv/src/dotenv/main.py Line 223 in e92ab1f
@bbc2 your thoughts and feedback are really appreciated |
This indeed looks like a problem. Thanks for reporting, I'll look into it. |
I would love to have this as my first contribution in pydotenv let me know if this is possible i may submit a PR. Thanks |
Yes you may submit an PR. Please try to see if the change could break an existing use case. We might have been loading values in that order for a reason. Let me know if you have questions about the implementation or the tests. |
Fixed by #258. |
Bug is a combination of override and interpolate.
contents of files is as follows:
foo.txt
bar.txt
test file:
when second
print_env()
runs, the values are:the reason for this is that the resolve_nested_variables method looks into existing ENV vars first and then looks at the current file's loaded values. (in our case,
Name
was loaded in the earlier file with valuefoo
).I believe the correct functionality would be to first look into the loaded file's values and then on the environment in order to keep the same behavior as the first file loaded.
The text was updated successfully, but these errors were encountered: