initial commit

This commit is contained in:
2025-09-11 18:24:36 +00:00
commit ba58bb60ec
16 changed files with 335 additions and 0 deletions

28
backend/settings.py Normal file
View File

@@ -0,0 +1,28 @@
import os
from pathlib import Path
from typing import Any
import yaml
from pydantic import ConfigDict
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
host: str = "0.0.0.0" # noqa: S104
port: int = 8000
workers: int = 1
log_level: str = "info"
model_config = ConfigDict(env_file=".env", env_file_encoding="utf-8")
def load_settings() -> Settings:
cfg_path = os.getenv("CONFIG_FILE")
if cfg_path and Path(cfg_path).exists():
with Path(cfg_path).open(encoding="utf-8") as f:
data: dict[str, Any] = yaml.safe_load(f) or {}
return Settings(**data)
return Settings()
settings = load_settings()