feat: Саватеев А трек 4

This commit is contained in:
Enterxx2
2026-11-02 23:13:38 +03:00
parent 445cfe4789
commit 081d0fd2c8
76 changed files with 6387 additions and 77 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