Skip to content

Commit

Permalink
fix(config): add correct handling of the bool values
Browse files Browse the repository at this point in the history
  • Loading branch information
pivoshenko committed Feb 8, 2025
1 parent 6dff21b commit f43d569
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/poetry_plugin_dotenv/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ def __init__(self, working_dir: str) -> None:
def _apply_source_config(self, source_config: dict[str, str | bool | None]) -> None:
"""Apply source configuration to the instance."""

for attribute, default_value in self.__dataclass_fields__.items():
source_value = source_config.get(attribute)
for field in self.__dataclass_fields__.values():
source_value = source_config.get(field.name)

if (
isinstance(default_value.type, bool)
isinstance(field.default, bool)
and source_value
and not isinstance(source_value, bool)
):
source_value = _as_bool(source_value)

if source_value is not None:
setattr(self, attribute, source_value)
setattr(self, field.name, source_value)


def _load_config_from_toml(filepath: str, section: str) -> dict[str, str | bool | None]:
Expand Down

0 comments on commit f43d569

Please sign in to comment.