feat(api): add public status endpoints with version injection

Replace health_handler with status_handler providing public /status and
/about endpoints. Add build-time version injection via ldflags in
Makefile, and support --version/-v CLI flag.

- Add /status endpoint returning runtime status, uptime, and version
- Add /about endpoint with system metadata (name, description, repo)
- Configure VERSION variable with git describe fallback
- Update swagger docs and api.md for new public endpoints
- Remove deprecated /api/status/test endpoint
This commit is contained in:
zenfun
2025-12-27 13:24:13 +08:00
parent 3d39c591fd
commit 637bfa8210
8 changed files with 317 additions and 159 deletions

View File

@@ -128,8 +128,14 @@ graph TD
## 4. API 模块概览
### 4.0 公开接口 (Auth API) - 无需中间件
- **身份识别**`GET /auth/whoami` - 根据 Token 返回身份类型和详细信息。
### 4.0 公开接口 - 无需鉴权
| 端点 | 说明 | 响应示例 |
|------|------|----------|
| `GET /health` | 健康检查(含依赖状态) | `{"status": "ok", "database": "up", "redis": "up", "uptime": "1h30m"}` |
| `GET /status` | 公开状态摘要 | `{"status": "ok", "uptime": "1h30m", "version": "v0.1.0"}` |
| `GET /about` | 系统信息 | `{"name": "EZ-API Gateway", "version": "v0.1.0", ...}` |
| `GET /auth/whoami` | 身份识别 | 根据 Token 返回身份类型和详细信息 |
| `GET /swagger/*` | API 文档 | Swagger UI |
### 4.1 管理端 (Admin API) - 需 Admin Token
- **租户管理**:创建 Master、签发子 Key、实时 QPS 监控、冻结/解冻。