from pydantic import BaseSettings, Field, validator class Config(BaseSettings): class Config: env_file = ".env" env_file_encoding = "utf-8" env: str = Field(env="ENVIRONMENT") debug: bool = Field(False, env="DEBUG") slzdb_uri: str = Field(env="SLZDB_URI") sentry_dsn: str = Field(None, env="SENTRY_DSN") @validator("debug", pre=True) def bool_type_casting(cls, bool_param: str) -> bool: return bool_param in ("True", "true", "TRUE", "1")