mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
feat(gateway): /g/:slug proxy data plane with key auth and rate limits (#66)
The admin surface under /admin/gateway managed api_services and api_keys, but no public route ever consumed them. Mounts /g/:slug and /g/:slug/* on the root router (outside /api/v1 so route_prefix stays clean) and runs the full pipeline: slug lookup -> X-API-Key/Bearer extraction -> prefix-indexed bcrypt key auth -> allowed_service_ids scope -> per-minute buckets (key and service caps) -> monthly usage_counters quotas -> gateway.ProxyRequest with per-service timeout and upstream auth headers -> usage/metrics/incident recording. Live-verified: proxied GET/POST, 401/404/429 boundaries, counter upserts, UPSTREAM_5XX incidents. Unit tests cover URL building, the rpm bucket, key extraction, and the service allowlist. Generated with [Devin](https://devin.ai) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
1409186a1f
commit
d5909172ae
5 files changed
+465
-2
No files matched your search
+3
-2
@@ -517,8 +517,9 @@ and wired refs, one click or one CLI call.
|
||||
|
||||
## 10. Carried-over debt (ROADMAP.md items still open)
|
||||
|
||||
- [ ] **Gateway traffic path** — mount `/g/:slug/*` → key → rate-limit →
|
||||
`gateway/proxy.go` → metrics. Management API exists; proxy unwired.
|
||||
- [x] **Gateway traffic path** — `/g/:slug/*` mounted → api_key auth →
|
||||
rpm + monthly quota → `gateway/proxy.go` → usage_counters /
|
||||
metrics_timeseries / incident_events.
|
||||
- [ ] **Preview environments runtime** — real build+deploy+subdomain+TTL
|
||||
(bookkeeping only now). Pairs with clone + multi-domain.
|
||||
- [ ] **Environments** — env switcher, per-env vars/domains, promote.
|
||||
|
||||
Reference in new issue
Block a user