feat: перенос core логиги

This commit is contained in:
Enterxx2
2026-11-24 00:49:06 +03:00
parent 20afc2c790
commit 4829fc7b4e
156 changed files with 11093 additions and 27 deletions
+17
View File
@@ -0,0 +1,17 @@
from pathlib import Path
def read_secret(path: Path) -> str:
"""
Секрет из файла (Docker/Compose secret в /run/secrets). Значение не
логируется и не попадает в текст ошибки — только путь.
"""
try:
value = path.read_text(encoding="utf-8").strip()
except OSError as error:
raise RuntimeError(
f"Не удалось прочитать секрет {path}: {type(error).__name__}"
) from None
if not value:
raise RuntimeError(f"Секрет {path} пуст")
return value