config.py 684 B

1234567891011121314151617181920
  1. import os
  2. from dotenv import load_dotenv
  3. from pathlib import Path
  4. env_path = Path('.') / '.env'
  5. load_dotenv(dotenv_path=env_path)
  6. class Settings:
  7. PROJECT_NAME:str = "Dash Board"
  8. PROJECT_VERSION: str = "1.0.0"
  9. POSTGRES_USER: str = os.getenv("POSTGRES_USER")
  10. POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD")
  11. POSTGRES_SERVER: str = os.getenv("POSTGRES_SERVER", "localhost")
  12. POSTGRES_PORT: str = os.getenv("POSTGRES_PORT", 5432) # default postgres port is 5432
  13. POSTGRES_DB: str = os.getenv("POSTGRES_DB", "tdd")
  14. DATABASE_URL = f"postgresql://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_SERVER}:{POSTGRES_PORT}/{POSTGRES_DB}"
  15. settings = Settings()