Skip to content
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

Feat basesetting dev #5961

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions changes/5908-oslijw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The loading of the configuration needs to add additional debug-level logging to facilitate the user to debug.

For this reason, I specifically added the configuration loading source to the deep_update function in utils.py.

At the same time, in order to be able to pass the instantiated Settings class, additional Added a variable, set it to None where it is not necessary to perform such an operation, and modified it in function-related positions
4 changes: 2 additions & 2 deletions pydantic/v1/env_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _build_values(
init_settings=init_settings, env_settings=env_settings, file_secret_settings=file_secret_settings
)
if sources:
return deep_update(*reversed([source(self) for source in sources]))
return deep_update(self, *reversed([source(self) for source in sources]))
else:
# no one should mean to do this, but I think returning an empty dict is marginally preferable
# to an informative error and much better than a confusing error
Expand Down Expand Up @@ -200,7 +200,7 @@ def __call__(self, settings: BaseSettings) -> Dict[str, Any]: # noqa C901
raise SettingsError(f'error parsing env var "{env_name}"') from e

if isinstance(env_val, dict):
d[field.alias] = deep_update(env_val, self.explode_env_vars(field, env_vars))
d[field.alias] = deep_update(None, env_val, self.explode_env_vars(field, env_vars))
else:
d[field.alias] = env_val
elif env_val is not None:
Expand Down