fastapi-dynamic-response/src/fastapi_dynamic_response/settings.py
Waylon S. Walker 19db26b0cb better errors
2024-10-17 08:20:37 -05:00

19 lines
406 B
Python

from pydantic import model_validator
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
ENV: str = "local"
DEBUG: bool = False
class Config:
env_file = "config.env"
@model_validator(mode="after")
def validate_debug(self):
if self.ENV == "local" and self.DEBUG is False:
self.DEBUG = True
return self
settings = Settings()