docs: document sheets export helpers
This commit is contained in:
1 parent
899e194447
commit
09be5d5969
1 file changed
+3
@@ -22,6 +22,7 @@ class GoogleSheetsExportConfig:
|
||||
|
||||
@classmethod
|
||||
def from_environment(cls) -> "GoogleSheetsExportConfig":
|
||||
"""Считывает флаг, URL webhook-а и токен из окружения приложения."""
|
||||
return cls(
|
||||
enabled=os.getenv("BELKI_GOOGLE_EXPORT_ENABLED", "0") == "1",
|
||||
url=os.getenv("BELKI_GOOGLE_EXPORT_URL", "").strip(),
|
||||
@@ -30,6 +31,7 @@ class GoogleSheetsExportConfig:
|
||||
|
||||
@property
|
||||
def ready(self) -> bool:
|
||||
"""Проверяет, что экспорт включён и настроен на HTTPS-адрес с hostname."""
|
||||
parsed = urlparse(self.url)
|
||||
return self.enabled and parsed.scheme == "https" and bool(parsed.hostname)
|
||||
|
||||
@@ -38,6 +40,7 @@ class GoogleSheetsExportService:
|
||||
"""Доставляет outbox-события; при выключенной интеграции ничего не делает."""
|
||||
|
||||
def __init__(self, store: ApplicationStore, config: GoogleSheetsExportConfig | None = None) -> None:
|
||||
"""Связывает сервис доставки с хранилищем заявок и конфигурацией."""
|
||||
self.store = store
|
||||
self.config = config or GoogleSheetsExportConfig.from_environment()
|
||||
|
||||
|
||||
Reference in new issue
Block a user