from pydantic_settings import BaseSettings from pydantic import computed_field class Settings(BaseSettings): POSTGRES_USER: str POSTGRES_PASSWORD: str POSTGRES_DB: str API_PORT: int = 8000 DEBUG: bool = False @computed_field @property def DATABASE_URL(self) -> str: return ( f"postgresql+asyncpg://" f"{self.POSTGRES_USER}:{self.POSTGRES_PASSWORD}" f"@db/{self.POSTGRES_DB}" ) class Config: env_file = ".env" settings = Settings()