forked from mtusi2026/mtusi2026lab2
ЛР 2: PostgreSQL, Bearer-сессии, Valkey и исследование восстановления
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""Only read secret values from files; never print DSNs or credentials."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def secret(name):
|
||||
return Path(os.environ[name + '_FILE']).read_text().strip()
|
||||
|
||||
|
||||
def integer(name, default, minimum=1, maximum=86400):
|
||||
value = int(os.environ.get(name, str(default)))
|
||||
if not minimum <= value <= maximum:
|
||||
raise ValueError('Invalid configuration: ' + name)
|
||||
return value
|
||||
Reference in New Issue
Block a user