Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: always validate config aliases

NTFSvolumee9309f60d2e6
diff --git a/cyberdrop_dl/config/__init__.py b/cyberdrop_dl/config/__init__.py
index 5d65235b6..9d56c048b 100644
--- a/cyberdrop_dl/config/__init__.py
+++ b/cyberdrop_dl/config/__init__.py
@@ -127,6 +127,10 @@ class Config(ConfigModel, title="cyberdrop-dl config"):
file.parent.mkdir(parents=True, exist_ok=True)
file.write_text(self.dump_yaml(), encoding="utf8")
+ @staticmethod
+ def load(data: dict[str, Any]) -> Config:
+ return Config.model_validate(data, by_alias=True, by_name=True)
+
@staticmethod
def from_file(file: Path) -> Config:
return Config.from_files(file, file.with_suffix(f".override{file.suffix}"))
@@ -147,7 +151,8 @@ class Config(ConfigModel, title="cyberdrop-dl config"):
sources.append(override)
data = merge_dicts(data, _load_yaml(override))
- config = Config.model_validate(data)
+ logger.info(data)
+ config = Config.load(data)
config._sources = tuple(sources)
return config