Add safe config fallbacks for app init and health checks

This commit is contained in:
2026-02-15 01:16:58 +03:00
parent 6d5fb9c258
commit b54a094185
3 changed files with 25 additions and 20 deletions

View File

@@ -9,7 +9,9 @@ def validate_cfg(cfg: dict[str, Any]) -> Tuple[List[str], List[str]]:
tg = cfg.get("telegram", {})
if not tg.get("token"):
errors.append("telegram.token is missing")
if not tg.get("admin_id"):
admin_ids = tg.get("admin_ids")
has_admin_ids = isinstance(admin_ids, list) and len(admin_ids) > 0
if not tg.get("admin_id") and not has_admin_ids:
errors.append("telegram.admin_id is missing")
thresholds = cfg.get("thresholds", {})