- Add Grant model with proper typing (uuid.UUID, timezone-aware datetime) - Add DB enum for grant_type to enforce valid values at database level - Configure SQLAlchemy Base with datetime timezone mapping - Harden Dockerfile: pin uv version, non-root user, security env vars - Update docker-compose with correct healthcheck database name - Add default database_url for Docker Compose deployment - Add PYTHONUNBUFFERED and PYTHONDONTWRITEBYTECODE env vars - Clean up .gitignore (merged into root)
24 lines
721 B
Python
24 lines
721 B
Python
from functools import lru_cache
|
|
from pathlib import Path
|
|
|
|
from pydantic import SecretStr
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
env_file = Path(__file__).parent.parent / ".env"
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
app_name: str = "Myst"
|
|
database_url: str = "postgresql+asyncpg://myst:myst@db:5432/myst_db" # Default for Docker Compose; override with DATABASE_URL env var in production
|
|
forgejo_base_url: str = ""
|
|
forgejo_pat: SecretStr = SecretStr("")
|
|
|
|
model_config = SettingsConfigDict(env_file=str(env_file))
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
"""Cached settings instance."""
|
|
return Settings()
|