@flaghoist/server 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,7 +27,10 @@ export default createFlagServer((env) => ({
27
27
 
28
28
  - `POST /ofrep/v1/evaluate/flags` and `/flags/:key`, the OFREP read path, behind the read API key.
29
29
  - `/api/v1/flags`, the admin CRUD API, behind admin auth, with an OpenAPI 3.1 document at
30
- `/api/v1/openapi.json`.
30
+ `/api/v1/openapi.json`. Also covers archive/restore, JSON export/import, and the audit log.
31
+ - `/api/v1/webhooks`, HMAC-signed HTTP callbacks fired on flag changes.
32
+ - `/api/v1/environments`, when `environments` is configured: named environments (`production`,
33
+ `staging`, ...) sharing one storage backend, with per-environment read keys via `apiKeys()`.
31
34
  - `/admin`, the dashboard, when you pass one.
32
35
 
33
36
  ## The dashboard
@@ -46,8 +49,25 @@ inlined, and it makes no requests to anything outside your server.
46
49
 
47
50
  ## Auth
48
51
 
49
- `bearerToken`, `apiKey` and `oidc` ship with it. Auth is an interface, so if none of those fit, pass
50
- your own function.
52
+ `bearerToken`, `apiKey`, `apiKeys` and `oidc` ship with it. `apiKeys` maps one read secret per
53
+ environment (`apiKeys({ production: '...', staging: '...' })`) instead of a single shared one, so a
54
+ leaked staging key can't read production. Auth is an interface, so if none of those fit, pass your
55
+ own function.
56
+
57
+ ## Environments
58
+
59
+ Pass `environments: ['production', 'staging', ...]` to partition flags without a second deploy or a
60
+ second database: the same key can be on in staging and off in production, each with its own audit
61
+ trail. The default environment uses bare storage keys, so turning this on for an existing deployment
62
+ needs no migration. See [docs.flaghoist.dev](https://docs.flaghoist.dev/api-reference/#environments)
63
+ for the full picture.
64
+
65
+ ## Webhooks
66
+
67
+ Manage endpoints under `/api/v1/webhooks` (or the dashboard's Webhooks page). Each delivery is a
68
+ signed `POST`: `X-Flaghoist-Signature: sha256=<hmac>` over the raw body, keyed by a secret generated
69
+ per webhook. Fire-and-forget with a 10s timeout and no retries, so treat it as a notification, not a
70
+ guaranteed log.
51
71
 
52
72
  ## Status
53
73