import os from dotenv import load_dotenv load_dotenv() # Environment Configuration DISABLE_MSAL = os.getenv("DISABLE_MSAL", "false").lower() == "true" BASE_PATH = os.getenv("BASE_PATH", "").rstrip("/") # Remove trailing slash def get_base_path() -> str: """Get the base path for URLs""" return BASE_PATH def get_full_url(path: str) -> str: """Get full URL with base path prefix""" path = path.lstrip("/") # Remove leading slash if BASE_PATH: return f"{BASE_PATH}/{path}" return f"/{path}" if path else "/" def is_msal_enabled() -> bool: """Check if MSAL authentication is enabled""" return not DISABLE_MSAL def get_msal_config(): """Get MSAL configuration if enabled""" if not is_msal_enabled(): return None return { "client_id": os.getenv("AZURE_CLIENT_ID"), "authority": os.getenv("AZURE_AUTHORITY"), "redirect_uri": os.getenv("AZURE_REDIRECT_URI"), }