⚙️ 配置
配置可通过环境变量、配置文件或命令行参数注入,优先级:参数 > 环境变量 > 文件。
配置文件
默认路径 ~/.config/go-icp/config.yaml,可用 --config 覆盖。
yaml
# 数据源
sources:
zhudun:
enabled: true
credentials:
- key: "${ZHUDUN_KEY_1}"
quota_daily: 1000
miit:
enabled: true # 补全路径
# 点选 OCR
ocr:
endpoint: "${OCR_ENDPOINT}"
token: "${OCR_TOKEN}"
max_retry: 3
# 限速
rate_limit:
zhudun: 5 # req/s
miit: 1 # req/s
# 缓存
cache:
backend: file
dir: ~/.cache/go-icp
ttl: 24h
# 输出
output:
format: json
pretty: true
# 日志
log:
level: info
format: json环境变量
所有配置项均可映射为 GO_ICP_<SECTION>_<KEY>,例如:
| 配置项 | 环境变量 |
|---|---|
sources.zhudun.credentials[0].key | ZHUDUN_KEY_1 |
ocr.token | OCR_TOKEN |
cache.ttl | GO_ICP_CACHE_TTL |
log.level | GO_ICP_LOG_LEVEL |
完整映射见 ⚙️ 配置项。
校验
bash
go-icp doctor # 检查配置与凭证可用性详见 🩺 doctor。