forked from mtusi2026/mtusi2026lab2
15 lines
508 B
Python
15 lines
508 B
Python
"""Runtime configuration; secret values are read only from mounted files."""
|
|
import os
|
|
from pathlib import Path
|
|
|
|
APP_HOST = os.getenv('APP_HOST', '0.0.0.0')
|
|
APP_PORT = int(os.getenv('APP_PORT', '8080'))
|
|
SESSION_TTL_SECONDS = int(os.getenv('SESSION_TTL_SECONDS', '3600'))
|
|
POOL_SIZE = int(os.getenv('DB_POOL_SIZE', '8'))
|
|
if SESSION_TTL_SECONDS < 1 or not 1 <= POOL_SIZE <= 32:
|
|
raise ValueError('Invalid TTL or pool size')
|
|
|
|
|
|
def secret(name):
|
|
return Path(os.environ[name + '_FILE']).read_text().strip()
|