Add POST /v1/events endpoint to the api-gateway that receives typed event envelopes and routes them to configured targets.
Why
Services generate events independently with no unified routing. Each webhook is point-to-point. Need a single ingestion point that can fan-out to multiple consumers.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
Add
POST /v1/eventsendpoint to the api-gateway that receives typed event envelopes and routes them to configured targets.Why
Services generate events independently with no unified routing. Each webhook is point-to-point. Need a single ingestion point that can fan-out to multiple consumers.
Design
Event Schema
Config-driven routing
Response
Files (homelab-frontend repo)
internal/events/event.go— types + validationinternal/events/router.go— match events to targetsinternal/events/handler.go— HTTP handlerinternal/config/— extend with EventsConfiginternal/proxy/proxy.go— register routeAcceptance
Functional
POST /v1/eventswith valid envelope returns202 Acceptedwith{event_id, status, targets, timestamp}POST /v1/eventswithoutAuthorizationheader returns401 UnauthorizedPOST /v1/eventswith JWT missingevents:publishcapability returns403 ForbiddenPOST /v1/eventswith malformed JSON returns400 Bad Requestwith RFC 9457 problem detailPOST /v1/eventswith missingsourceortypefield returns400with specific validation error{source: "forgejo", type: "pr.created"}routes to both gotify and sqs targets per configtype: "pr.*"matchespr.created,pr.merged,pr.closedbut notpush{source: "*", type: "*"}catches unmatched events400with"no route for event type"Audit
{"level":"info","message":"event routed","extra":{"event_id":"...","source":"forgejo","type":"pr.created","targets":"gotify,sqs:forgejo-events"}}Tests
go test ./internal/events/passes — router matching logic (exact, glob, wildcard, no-match)go test ./internal/events/passes — handler validation (missing fields, bad JSON, auth)poimen referenced this issue2026-09-09 23:43:35 +00:00