ЛР3 на 3

Co-authored-by: Югай Артур Рустамович <f1ekserr@yandex.ru>
This commit is contained in:
2026-11-16 22:23:04 +03:00
co-authored by Югай Артур Рустамович
parent 0ab3a341aa
commit 09aece58fe
37 changed files with 2651 additions and 35 deletions
+23
View File
@@ -0,0 +1,23 @@
import os
from pathlib import Path
def secret(name):
value = Path(os.environ[name]).read_text(encoding="utf-8").strip()
if not value:
raise ValueError(f"Empty secret file: {name}")
return value
def session_ttl():
value = int(os.environ.get("SESSION_TTL_SECONDS", "3600"))
if not 1 <= value <= 86400:
raise ValueError("SESSION_TTL_SECONDS must be between 1 and 86400")
return value
def idempotency_ttl():
value = int(os.environ.get("IDEMPOTENCY_TTL_SECONDS", "86400"))
if value < 86400:
raise ValueError("IDEMPOTENCY_TTL_SECONDS must be at least 86400")
return value