Files
mtusi2026lab2/app/config.py
T

24 lines
607 B
Python

import os
from dataclasses import dataclass
@dataclass(frozen=True)
class Settings:
host: str
port: int
env: str
log_level: str
shutdown_timeout: int
session_ttl_seconds: int
def load_settings() -> Settings:
return Settings(
host=os.getenv('APP_HOST', '0.0.0.0'),
port=int(os.getenv('APP_PORT', '8080')),
env=os.getenv('APP_ENV', 'lab'),
log_level=os.getenv('LOG_LEVEL', 'info').lower(),
shutdown_timeout=int(os.getenv('SHUTDOWN_TIMEOUT_SECONDS', '5')),
session_ttl_seconds=int(os.getenv('SESSION_TTL_SECONDS', '3600')),
)