Last active
August 11, 2023 15:44
-
-
Save patriciojlg/f19cce3eff9c4f47e23a8fa5366ac98a to your computer and use it in GitHub Desktop.
globalsetting_pydantic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydantic import BaseSettings | |
class GlobalConfig(BaseSettings): | |
APP_NAME: str = "Mi Aplicación" | |
APP_VERSION: str = "1.0.0" | |
DEBUG: bool = False | |
DATABASE_URL: str | |
class Config: | |
env_prefix = "MYAPP_" # variables de entorno deberán comenzar con este prefijo | |
case_sensitive = True | |
# Obtener configuración desde variables de entorno o valores por defecto | |
config = GlobalConfig() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment