-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathconfig.toml.example
More file actions
144 lines (132 loc) · 4.13 KB
/
config.toml.example
File metadata and controls
144 lines (132 loc) · 4.13 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# KeyCompute 配置文件示例
# 复制此文件为 config.toml 并根据需要修改
# 环境变量优先级高于配置文件,格式:KC__SECTION__KEY=value
# ==================== 服务器配置 ====================
[server]
# 服务器绑定地址
bind_addr = "0.0.0.0"
# 服务器监听端口
port = 3000
# 工作线程数(可选,默认使用 CPU 核心数)
# workers = 4
# ==================== 数据库配置 ====================
[database]
# PostgreSQL 连接 URL
url = "postgres://localhost/keycompute"
# 最大连接数
max_connections = 10
# 最小连接数
min_connections = 2
# 连接超时时间(秒)
connect_timeout_secs = 30
# 连接空闲超时时间(秒)
idle_timeout_secs = 600
# 连接最大生命周期(秒)
max_lifetime_secs = 1800
# ==================== Redis 配置(可选)====================
[redis]
# Redis 连接 URL
url = "redis://127.0.0.1:6379"
# 键前缀(用于多租户隔离)
# key_prefix = "kc:prod:"
# 连接池大小
pool_size = 10
# 连接超时(秒)
connect_timeout_secs = 5
# ==================== 认证配置 ====================
[auth]
# JWT 密钥(生产环境必须修改!)
jwt_secret = "change-me-in-production"
# JWT 签发者
jwt_issuer = "keycompute"
# JWT 过期时间(秒)
jwt_expiry_secs = 3600
# ==================== Gateway 配置 ====================
[gateway]
# 最大重试次数
max_retries = 3
# 请求超时时间(秒)
timeout_secs = 120
# 是否启用 fallback
enable_fallback = true
# HTTP 请求超时(秒)
request_timeout_secs = 120
# 流式请求超时(秒)
stream_timeout_secs = 600
[gateway.retry]
# 初始退避时间(毫秒)
initial_backoff_ms = 100
# 最大退避时间(毫秒)
max_backoff_ms = 10000
# 退避倍数
backoff_multiplier = 2.0
# Gateway HTTP 代理配置(可选)
# 用于多代理出口、按 Provider 路由到不同代理
# [gateway.proxy]
# Provider 级代理映射
# [gateway.proxy.providers]
# openai = "http://proxy-openai:8080"
# claude = "http://proxy-claude:8080"
# deepseek = "http://proxy-cn:8080"
# 账号级代理映射(可选,最高优先级)
# [gateway.proxy.accounts]
# "openai:550e8400-e29b-41d4-a716-446655440000" = "http://premium-proxy:8080"
# 通配符规则(可选)
# [gateway.proxy.patterns]
# "*-cn" = "http://cn-proxy:8080"
# "openai-*" = "http://openai-proxy:8080"
# ==================== 加密配置(可选)====================
# 用于上游 Provider API Key 的加密存储
# 生产环境强烈建议配置!
#
# [crypto]
# 加密密钥(Base64 编码的 32 字节密钥)
# 生成方式:openssl rand -base64 32
# 或在代码中:keycompute_runtime::ApiKeyCrypto::generate_key()
#
# 环境变量方式(推荐):KC__CRYPTO__SECRET_KEY
#
# secret_key = "your-base64-encoded-32-byte-key"
# ==================== 邮件服务配置 ====================
# 用于发送邮箱验证、密码重置等邮件
# 邮箱认证功能必需配置!
#
[email]
# SMTP 服务器地址
smtp_host = "smtp.example.com"
# SMTP 端口(默认 587)
smtp_port = 587
# SMTP 用户名
smtp_username = "noreply@example.com"
# SMTP 密码
smtp_password = "your-smtp-password"
# 发件人邮箱地址
from_address = "noreply@example.com"
# 发件人显示名称(可选)
from_name = "KeyCompute"
# 是否使用 TLS(默认 true)
use_tls = true
# 验证链接基础 URL(用于生成邮箱验证和密码重置链接)
verification_base_url = "https://api.example.com"
# 邮件发送超时(秒,默认 30)
timeout_secs = 30
#
# 环境变量方式:
# KC__EMAIL__SMTP_HOST=smtp.example.com
# KC__EMAIL__SMTP_PORT=587
# KC__EMAIL__SMTP_USERNAME=noreply@example.com
# KC__EMAIL__SMTP_PASSWORD=your-smtp-password
# KC__EMAIL__FROM_ADDRESS=noreply@example.com
# KC__EMAIL__VERIFICATION_BASE_URL=https://api.example.com
# ==================== 默认管理员配置 ====================
# 首次启动时自动创建的系统管理员账号
# 生产环境部署后请立即修改默认密码!
[admin]
# 默认管理员邮箱
default_email = "admin@keycompute.local"
# 默认管理员密码
default_password = "12345"
#
# 环境变量方式:
# KC__DEFAULT_ADMIN_EMAIL=admin@keycompute.local
# KC__DEFAULT_ADMIN_PASSWORD=12345