27 lines
999 B
Python
27 lines
999 B
Python
import os
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Settings:
|
|
app_name: str = os.getenv("APP_NAME", "Microsoft 365 Service")
|
|
app_version: str = os.getenv("APP_VERSION", "1.0.1")
|
|
root_path: str = os.getenv("ROOT_PATH", "")
|
|
tenant_id: str = os.getenv("MS365_TENANT_ID", "")
|
|
client_id: str = os.getenv("MS365_CLIENT_ID", "")
|
|
client_secret: str = os.getenv("MS365_CLIENT_SECRET", "")
|
|
graph_base_url: str = os.getenv("MS365_GRAPH_BASE_URL", "https://graph.microsoft.com/v1.0")
|
|
graph_scope: str = os.getenv("MS365_GRAPH_SCOPE", "https://graph.microsoft.com/.default")
|
|
request_timeout_seconds: float = float(os.getenv("MS365_REQUEST_TIMEOUT_SECONDS", "30"))
|
|
|
|
@property
|
|
def token_url(self) -> str:
|
|
return f"https://login.microsoftonline.com/{self.tenant_id}/oauth2/v2.0/token"
|
|
|
|
@property
|
|
def is_configured(self) -> bool:
|
|
return bool(self.tenant_id and self.client_id and self.client_secret)
|
|
|
|
|
|
settings = Settings()
|