-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
EnvSettingsSource does not respect populate_by_name for aliased fields #452
Comments
Thanks @hozn for reporting this issue.
It would be great if you could work on a PR that adds |
Ok, it would be nice / would have saved me some time stepping through with the debugger 😂 if this were documented as just not being supported, since But, yes, I will work on a PR as time allows! |
…ts to validate this works.
@hramezani -- this proved easy to add and very obvious on how to add tests (if I did it right 😅 ) -- thanks for making that easy. Obviously let me know in PR if additional work needed. |
Great work @hozn |
It looks like the logic to extract fields from the environment (e.g.
os.environ
) only respects the alias for aliased Fields vs. also allowing for env vars to be set by name whenpopulate_by_name=True
in the model config.Simple reproduce script:
Note that changing the env source to use a custom source does appear to address this, though I'm not confident this is the correct approach:
I suspect this issue may also apply to DotEnvSettingsSource, but I have not experimented as comprehensively with this one.
The text was updated successfully, but these errors were encountered: