ligbox-ops-platform/app/push_service.py
Ligbox Spec Hub 3a2c64834b Initial import: ligbox-ops-platform + specs + LAPTOP + obsidian merge (CT130)
Source: VM122 /opt + obsidian-infra + LAPTOP
Hub: CT130 spec-hub 10.10.10.130
2026-06-19 17:26:41 +00:00

27 lines
832 B
Python

"""Ops push notifications — Spec 007 phase A (onboarding events)."""
from __future__ import annotations
import os
from app import ntfy_notify
OPS_NTFY_TOPIC = os.getenv("DESK_OPS_NTFY_TOPIC", "").strip()
PUSH_ONBOARD_EVENTS = frozenset({
"session.started",
"onboarding.started",
"onboarding.failed",
"integration.gap",
})
def notify_ops_event(event: str, *, domain: str | None = None, detail: str = "") -> bool:
if event not in PUSH_ONBOARD_EVENTS:
return False
if not OPS_NTFY_TOPIC:
return False
dom = domain or "sem domínio"
title = f"Ligbox Ops — {event}"
body = detail or dom
priority = "high" if event in ("onboarding.started", "onboarding.failed", "integration.gap") else "default"
return ntfy_notify.push(OPS_NTFY_TOPIC, title, body, priority=priority)