-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml.example
More file actions
97 lines (82 loc) · 4 KB
/
Copy pathconfig.yaml.example
File metadata and controls
97 lines (82 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# HTTP Service 配置文件示例
# 使用前请复制此文件为 config.yaml 并修改其中的配置项
#
# 环境变量支持:
# 所有配置项都可以通过环境变量覆盖,格式为:VDOC_<SECTION>_<KEY>
# 例如:
# export VDOC_SERVER_PORT=9090 # 覆盖 server.port
# export VDOC_JWT_KEY="$(openssl rand -base64 32)" # 覆盖 jwt.key
# export VDOC_LOG_MAX_SIZE=100 # 覆盖 log.max_size
#
# 配置文件查找顺序:
# 1. 工作目录 (./config.yaml)
# 2. 系统目录 (/etc/vdoc/config.yaml)
server:
# HTTP 监听地址;仅本机访问可改为 127.0.0.1。
host: "0.0.0.0"
port: 8080
# 相对路径基于工作目录。已有 PID 文件时拒绝启动,避免重复实例互相覆盖。
# 异常退出可能遗留该文件;确认没有 Vdoc 实例使用后再手动删除。
pid_file: "vdoc.pid"
# 服务进程只提供 HTTP。HTTPS/TLS 建议由 Caddy、Nginx、Ingress 等反向代理统一处理。
# 请求限制配置
max_body_size: "10MB" # 请求体大小限制,支持 KB/MB/GB
max_header_bytes: 1048576 # 请求头大小限制(字节),默认 1MB
# 超时配置
shutdown_timeout: "10s" # 优雅关闭超时时间
read_timeout: "30s" # 读取超时
write_timeout: "180s" # 响应写入超时,覆盖最长 120s 的 AI 请求及处理时间
idle_timeout: "120s" # 空闲连接超时
# 全局限流配置(可选)
enable_rate_limit: false # 是否启用全局限流
global_rate_limit: 100 # 全局限流速率(每秒请求数)
global_rate_burst: 200 # 全局限流突发容量
# 静态文件目录;相对路径基于工作目录,设为空字符串可关闭 /static。
static_dir: "./static"
# 精确列出允许访问 API 的 Admin Origin;生产环境不要使用通配符。
cors_allowed_origins:
- "http://localhost:5173"
- "http://127.0.0.1:5173"
# 仅在 Caddy/Nginx/Ingress 反向代理 backend 时填写其精确 IP/CIDR。
# 直连部署保持为空;禁止信任 0.0.0.0/0 或 ::/0。
trusted_proxies: []
jwt:
key: "" # 必须设置为至少32字符的强密钥,可用 openssl rand -base64 32 生成
expiration: "12h" # JWT token 过期时间,格式: 12h, 24h, 30m 等
# 匿名 HTTP 注册默认关闭。生产环境应通过 initial_admin 引导首个管理员。
auth:
allow_registration: false # 环境变量:VDOC_AUTH_ALLOW_REGISTRATION
rate_limit: 2 # register/login 每 IP 每秒请求数
rate_burst: 5 # register/login 每 IP 突发容量
# 初始管理员账号。仅用户表为空时自动创建;email/password 留空则不创建。
# 环境变量:VDOC_INITIAL_ADMIN_EMAIL、VDOC_INITIAL_ADMIN_NAME、VDOC_INITIAL_ADMIN_PASSWORD
# 忘记密码时通过 stdin 执行,禁止把密码放进 argv:printf '%s\n' "$NEW_PASSWORD" | ./vdoc --resetadmin <email>
initial_admin:
email: ""
name: ""
password: "" # 明文密码仅用于首次启动创建账号;12–72 bytes,入库前会 bcrypt 哈希
log:
max_size: 50 # 单个日志文件最大大小(MB)
max_age: 30 # 保留旧日志文件的最大天数
level: "info" # 业务日志级别: debug, info, warn, error
gin_level: "" # Gin access/error 日志级别;为空时跟随 level
database:
enabled: false
dsn: "postgres://vdoc:<password>@127.0.0.1:5432/vdoc?sslmode=disable"
max_open_conns: 20
max_idle_conns: 5
storage:
enabled: false
endpoint: "127.0.0.1:9000"
bucket: "vdoc"
access_key: ""
secret_key: ""
region: "us-east-1"
use_ssl: false
path_style: true
mcp_token:
cipher_key: "" # 可选;为空时复用 jwt.key,生产环境建议设置独立的至少32字符密钥
cipher_kid: "local-aes-gcm-v1"
# 仅用于解密旧数据;启动时验证并把旧 KID 的 MCP token、AI key、分享密文原子重加密到 active KID。
# 不要复用 KID 对应不同 key。完成一次成功轮换并确认数据库只剩 active KID 后删除旧 key。
cipher_keyring: {}