2026-05-20 16:38:48 -05:00
|
|
|
import json
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
from config_model import Config, HanaConfig, FilesConfig, OutlookConfig, MailConfig
|
|
|
|
|
|
|
|
|
|
########################################################
|
|
|
|
|
CONFIG_PATH = Path(__file__).resolve().parent / "config.json"
|
|
|
|
|
|
|
|
|
|
with open(CONFIG_PATH, 'r', encoding='utf-8') as f:
|
|
|
|
|
data = json.load(f)
|
|
|
|
|
|
|
|
|
|
# Instantiate dataclasses
|
|
|
|
|
hana = HanaConfig(**data.get('hana', {}))
|
|
|
|
|
files = FilesConfig(**data.get('files', {}))
|
|
|
|
|
outlook = OutlookConfig(
|
|
|
|
|
client_id=data['outlook']['client_id'],
|
|
|
|
|
client_secret=data['outlook']['client_secret'],
|
|
|
|
|
tenant_id=data['outlook']['tenant_id'],
|
|
|
|
|
download_folder=data['outlook']['download_folder'],
|
|
|
|
|
verify_ssl=data['outlook'].get('verify_ssl', True),
|
|
|
|
|
ca_bundle=data['outlook'].get('ca_bundle')
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
mail = MailConfig(
|
|
|
|
|
sender=data['mail']['sender'],
|
2026-05-21 09:56:07 -05:00
|
|
|
to=data['mail']['to'],
|
|
|
|
|
days=data['mail']['days']
|
2026-05-20 16:38:48 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
CONFIG = Config(
|
|
|
|
|
hana=hana,
|
|
|
|
|
files=files,
|
|
|
|
|
outlook=outlook,
|
|
|
|
|
mail=mail
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
########################################################
|