This commit is contained in:
2026-05-30 00:48:16 +05:00
parent 1da4f2e1b6
commit 3dc2bdd631
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
0.0.113
0.0.114
+8
View File
@@ -57,8 +57,16 @@ class Config:
def load_config(path: str | None = None) -> Config:
path = path or os.environ.get("NVR_CONFIG", "cameras.yaml")
# Толерантно к отсутствию/повреждению: если файла нет, на его месте каталог
# (битый bind-mount) или YAML невалиден — стартуем без камер (добавляются из UI),
# а не падаем с ошибкой на старте.
raw: dict = {}
if os.path.isfile(path):
try:
with open(path, "r", encoding="utf-8") as fh:
raw = yaml.safe_load(fh) or {}
except (OSError, yaml.YAMLError):
raw = {}
storage = Storage(**(raw.get("storage") or {}))
live = Live(**(raw.get("live") or {}))