from pydantic import BaseModel from pydantic import PostgresDsn from pydantic import MariaDBDsn from pydantic import MySQLDsn from pydantic_settings import ( BaseSettings, SettingsConfigDict, ) class RunConfig(BaseModel): host: str = '0.0.0.0' port: int = 8000 reload: bool = True class ApiPrefix(BaseModel): prefix: str = '/api' class DatabaseConfig(BaseModel): url: PostgresDsn echo: bool = False echo_pool: bool = False pool_size: int = 50 max_overflow: int = 10 class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=('.env-template', '.env'), case_sensitive=False, env_nested_delimiter='__', env_prefix='SIPI_CONFIG__', ) run: RunConfig = RunConfig() api: ApiPrefix = ApiPrefix() db: DatabaseConfig settings = Settings()