better errors

This commit is contained in:
Waylon S. Walker 2024-10-17 08:20:37 -05:00
parent c8afba360b
commit 19db26b0cb
5 changed files with 84 additions and 82 deletions

View file

@ -1,8 +1,19 @@
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()