import os from typing import Any, Tuple, List def validate_cfg(cfg: dict[str, Any]) -> Tuple[List[str], List[str]]: errors: List[str] = [] warnings: List[str] = [] tg = cfg.get("telegram", {}) if not tg.get("token"): errors.append("telegram.token is missing") if not tg.get("admin_id"): errors.append("telegram.admin_id is missing") thresholds = cfg.get("thresholds", {}) for key in ("disk_warn", "load_warn", "high_load_warn"): if key not in thresholds: warnings.append(f"thresholds.{key} not set") paths = cfg.get("paths", {}) env_path = paths.get("restic_env") if env_path and not os.path.exists(env_path): warnings.append(f"paths.restic_env not found: {env_path}") npm = cfg.get("npmplus", {}) if npm and not npm.get("token") and (not npm.get("identity") or not npm.get("secret")): warnings.append("npmplus: token missing and identity/secret missing") ow = cfg.get("openwrt", {}) if ow and not ow.get("host"): warnings.append("openwrt.host is missing") return errors, warnings