better errors
This commit is contained in:
parent
c8afba360b
commit
19db26b0cb
5 changed files with 84 additions and 82 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue