Rename product to OrbitWard

This commit is contained in:
Keith Smith
2026-05-26 21:24:54 -06:00
parent af72a6c563
commit 177bdcc8a7
41 changed files with 129 additions and 105 deletions
+1 -1
View File
@@ -1 +1 @@
"""OrbitalWard worker package."""
"""OrbitWard worker package."""
+1 -1
View File
@@ -78,7 +78,7 @@ def _resolve_ipv4(host: str) -> str:
def _build_icmp_echo_request(identifier: int, sequence: int) -> bytes:
payload = b"OrbitalWard ping"
payload = b"OrbitWard ping"
header = struct.pack("!BBHHH", 8, 0, 0, identifier, sequence)
checksum = _icmp_checksum(header + payload)
header = struct.pack("!BBHHH", 8, 0, checksum, identifier, sequence)
+7 -3
View File
@@ -1,14 +1,18 @@
from functools import lru_cache
from pydantic import AliasChoices, Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
orbitalward_env: str = "development"
orbitalward_secret_key: str = "change-me"
database_url: str = "postgresql+psycopg://orbitalward:orbitalward@postgres:5432/orbitalward"
orbitward_env: str = Field(default="development", validation_alias=AliasChoices("ORBITWARD_ENV", "ORBITALWARD_ENV"))
orbitward_secret_key: str = Field(
default="change-me",
validation_alias=AliasChoices("ORBITWARD_SECRET_KEY", "ORBITALWARD_SECRET_KEY"),
)
database_url: str = "postgresql+psycopg://orbitward:orbitward@postgres:5432/orbitward"
redis_url: str = "redis://redis:6379/0"
frontend_url: str = "http://localhost:5173"
backend_url: str = "http://localhost:8000"
+3 -3
View File
@@ -24,7 +24,7 @@ class Scheduler:
self._stopped = asyncio.Event()
async def run(self) -> None:
logger.info("OrbitalWard worker started for %s", settings.orbitalward_env)
logger.info("OrbitWard worker started for %s", settings.orbitward_env)
while not self._stopped.is_set():
await self.tick()
try:
@@ -249,7 +249,7 @@ class Scheduler:
await self._post_webhook(
url,
self._format_incident_message(incident, monitor, event_type),
str((channel.settings or {}).get("username") or "OrbitalWard"),
str((channel.settings or {}).get("username") or "OrbitWard"),
)
except httpx.HTTPError:
logger.exception("Notification delivery failed for channel %s", channel.id)
@@ -296,5 +296,5 @@ class Scheduler:
last_message = (incident.details or {}).get("last_message")
if last_message:
body.append(f"Last response: {last_message}")
body.extend(["", f"View in OrbitalWard: {settings.frontend_url}/incidents/{incident.id}"])
body.extend(["", f"View in OrbitWard: {settings.frontend_url}/incidents/{incident.id}"])
return "\n".join(str(line) for line in body)
+1 -1
View File
@@ -7,7 +7,7 @@ from app.config import settings
def _fernet() -> Fernet:
digest = hashlib.sha256(settings.orbitalward_secret_key.encode("utf-8")).digest()
digest = hashlib.sha256(settings.orbitward_secret_key.encode("utf-8")).digest()
return Fernet(base64.urlsafe_b64encode(digest))
+2 -2
View File
@@ -1,7 +1,7 @@
[project]
name = "orbitalward-worker"
name = "orbitward-worker"
version = "0.1.0"
description = "OrbitalWard background worker"
description = "OrbitWard background worker"
requires-python = ">=3.12"
dependencies = [
"cryptography>=48.0.0",
+5 -5
View File
@@ -16,7 +16,7 @@ from app.scheduler import Scheduler
def encrypt_secret(value: str) -> str:
digest = hashlib.sha256(settings.orbitalward_secret_key.encode("utf-8")).digest()
digest = hashlib.sha256(settings.orbitward_secret_key.encode("utf-8")).digest()
return Fernet(base64.urlsafe_b64encode(digest)).encrypt(value.encode("utf-8")).decode("utf-8")
@@ -102,8 +102,8 @@ class SchedulerTestCase(unittest.IsolatedAsyncioTestCase):
channel = NotificationChannel(
name="Ops Webhook",
channel_type="generic_webhook",
settings={"username": "OrbitalWard"},
encrypted_secret=encrypt_secret("https://hooks.example.test/orbitalward"),
settings={"username": "OrbitWard"},
encrypted_secret=encrypt_secret("https://hooks.example.test/orbitward"),
is_enabled=True,
)
self.db.add(channel)
@@ -121,8 +121,8 @@ class SchedulerTestCase(unittest.IsolatedAsyncioTestCase):
assert incident is not None
assert incident.status == "open"
assert len(scheduler.posts) == 1
assert scheduler.posts[0]["url"] == "https://hooks.example.test/orbitalward"
assert scheduler.posts[0]["username"] == "OrbitalWard"
assert scheduler.posts[0]["url"] == "https://hooks.example.test/orbitward"
assert scheduler.posts[0]["username"] == "OrbitWard"
assert incident.details["notification_history"][0]["event"] == "opened"
await scheduler._send_incident_notifications(self.db, incident, monitor, "opened", datetime.now(UTC))