feat: inform about skipped cfg files

This commit is contained in:
Daniel Langbein 2024-12-09 11:06:18 +01:00
parent f231334e1b
commit 9ab7e48159
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -24,12 +24,12 @@ def main():
cfg_dir: Path = args.cfg_dir cfg_dir: Path = args.cfg_dir
cache: RecordDestinationCache | None = args.cache cache: RecordDestinationCache | None = args.cache
cfg_files = [file for file in cfg_dir.iterdir() if file.name.endswith('.json') and file.is_file()] cfg_files: list[Path] = [file for file in cfg_dir.iterdir() if file.name.endswith('.json') and file.is_file()]
for cfg_file in cfg_files: for cfg_file in cfg_files:
cfg: dict = json.loads(cfg_file.read_text()) cfg: dict = json.loads(cfg_file.read_text())
if len(cfg) == 0 or ('disabled' in cfg and cfg['disabled'] is True): if len(cfg) == 0 or ('disabled' in cfg and cfg['disabled'] is True):
# Skip empty or disabled configuration file. print(f'Skipped empty or disabled config file {cfg_file.absolute()}')
continue continue
customer = cfg['customer'] customer = cfg['customer']