Skip to content

Instantly share code, notes, and snippets.

@patriciojlg
Last active August 11, 2023 15:44
Show Gist options
  • Save patriciojlg/f19cce3eff9c4f47e23a8fa5366ac98a to your computer and use it in GitHub Desktop.
Save patriciojlg/f19cce3eff9c4f47e23a8fa5366ac98a to your computer and use it in GitHub Desktop.
globalsetting_pydantic.py
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