Files
css-test/app/core/settings.py
T

31 lines
780 B
Python

from functools import lru_cache
from os import getenv
from pathlib import Path
from dotenv import load_dotenv
PROJECT_ROOT = Path(__file__).resolve().parents[2]
load_dotenv(PROJECT_ROOT / ".env")
class Settings:
def __init__(self) -> None:
self.session_secret_key = getenv(
"SESSION_SECRET_KEY", "change-me-in-production"
)
self.azure_tenant_id = getenv("AZURE_TENANT_ID")
self.azure_client_id = getenv("AZURE_CLIENT_ID")
self.azure_client_secret = getenv("AZURE_CLIENT_SECRET")
@property
def azure_configured(self) -> bool:
return bool(
self.azure_tenant_id and self.azure_client_id and self.azure_client_secret
)
@lru_cache
def get_settings() -> Settings:
return Settings()