credentials do hlavicky + crypto + docu
This commit is contained in:
+10
-1
@@ -1,5 +1,5 @@
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, replace
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -10,6 +10,7 @@ class Settings:
|
||||
tenant_id: str = os.getenv("MS365_TENANT_ID", "")
|
||||
client_id: str = os.getenv("MS365_CLIENT_ID", "")
|
||||
client_secret: str = os.getenv("MS365_CLIENT_SECRET", "")
|
||||
credential_encoding_secret: str = os.getenv("MS365_CREDENTIAL_ENCODING_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"))
|
||||
@@ -22,5 +23,13 @@ class Settings:
|
||||
def is_configured(self) -> bool:
|
||||
return bool(self.tenant_id and self.client_id and self.client_secret)
|
||||
|
||||
def with_credentials(self, tenant_id: str, client_id: str, client_secret: str) -> "Settings":
|
||||
return replace(
|
||||
self,
|
||||
tenant_id=tenant_id,
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
Reference in New Issue
Block a user