"""Load deploy parameters from JSON or config.txt style files.""" from __future__ import annotations import json from pathlib import Path from typing import Any def load_params_file(path: str | Path) -> dict[str, Any]: config_path = Path(path) text = config_path.read_text(encoding="utf-8") stripped = text.lstrip() if stripped.startswith("{"): return json.loads(text) values: dict[str, Any] = {} for raw_line in text.splitlines(): line = raw_line.strip() if not line or line.startswith("#"): continue if "=" not in line: continue key, value = line.split("=", 1) values[key.strip()] = value.strip() return values