feat(api): add feature flag management endpoints

Add FeatureHandler to manage lightweight runtime configuration toggles
stored in the Redis `meta:features` hash. This enables dynamic control
over system behavior (e.g., storage backends) via the admin API.

- Add `GET /admin/features` to list flags
- Add `PUT /admin/features` to update flags
- Update README with feature flag documentation
This commit is contained in:
zenfun
2025-12-15 15:01:01 +08:00
parent fb68e0f155
commit 11f6e81798
3 changed files with 121 additions and 0 deletions

View File

@@ -26,6 +26,18 @@ EZ-API 是"大脑"。它管理着事实的来源 (Source of Truth)。
- `POST /models`: 注册支持的模型。
- `GET /models`: 列出所有模型。
### Feature Flags给未来前端用
控制平面会把轻量“开关配置”存到 Redis 的 hash`meta:features`,并提供管理接口:
- `GET /admin/features`
- `PUT /admin/features`body 为 JSON map
常用 flags
- `dp_state_store_backend`: `memory`(默认)/ `redis`
- `dp_claude_cross_upstream`: `true` / `false`
### 系统接口
- `POST /sync/snapshot`: 强制将 DB 状态全量重新同步到 Redis。
- `POST /logs`: 供 Balancer 推送日志的内部端点 (异步)。