Implement lab2 PostgreSQL storage and persistent sessions

This commit is contained in:
Югай Артур Рустамович
2026-11-09 20:21:42 +03:00
parent 65003b6119
commit 8757a93f0a
29 changed files with 1727 additions and 30 deletions
+16
View File
@@ -0,0 +1,16 @@
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