mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-11 19:57:41 +08:00
feat: Improve configuration loading robustness, add Vercel-specific fallbacks, and update documentation for config.json best practices.
This commit is contained in:
23
API.md
23
API.md
@@ -9,6 +9,7 @@
|
||||
## 目录
|
||||
|
||||
- [基础信息](#基础信息)
|
||||
- [配置最佳实践](#配置最佳实践)
|
||||
- [鉴权规则](#鉴权规则)
|
||||
- [路由总览](#路由总览)
|
||||
- [健康检查](#健康检查)
|
||||
@@ -31,6 +32,28 @@
|
||||
|
||||
---
|
||||
|
||||
## 配置最佳实践
|
||||
|
||||
推荐把 `config.json` 作为唯一配置源:
|
||||
|
||||
```bash
|
||||
cp config.example.json config.json
|
||||
# 编辑 config.json(keys/accounts)
|
||||
```
|
||||
|
||||
按部署方式使用:
|
||||
|
||||
- 本地运行:直接读取 `config.json`
|
||||
- Docker / Vercel:从 `config.json` 生成 Base64,填入 `DS2API_CONFIG_JSON`
|
||||
|
||||
```bash
|
||||
DS2API_CONFIG_JSON="$(base64 < config.json | tr -d '\n')"
|
||||
```
|
||||
|
||||
Vercel 一键部署可先只填 `DS2API_ADMIN_KEY`,部署后在 `/admin` 导入配置,再通过 “Vercel 同步” 写回环境变量。
|
||||
|
||||
---
|
||||
|
||||
## 鉴权规则
|
||||
|
||||
### 业务接口(`/v1/*`、`/anthropic/*`)
|
||||
|
||||
Reference in New Issue
Block a user