feat(server): 限流 fail-close 统一配置
- 新增 RateLimitConfig 结构体,支持 config.toml + 环境变量 - apply_rate_limit 统一读取 fail_close 配置,生产环境可设为拒绝请求 - account_lockout_middleware 改为从 AppState.config 读取,不再直接读环境变量 - default.toml 添加 [rate_limit] 配置节
This commit is contained in:
@@ -41,8 +41,8 @@ kek = "__MUST_SET_VIA_ENV__"
|
||||
|
||||
[ai]
|
||||
default_provider = "claude"
|
||||
# AI API 密钥。留空则禁用 AI 功能;生产环境必须通过 ERP__AI__API_KEY 设置。
|
||||
api_key = ""
|
||||
base_url = "https://api.anthropic.com"
|
||||
model = "claude-sonnet-4-6"
|
||||
max_tokens = 2048
|
||||
temperature = 0.3
|
||||
@@ -52,3 +52,8 @@ rate_limit_patient_daily = 10
|
||||
[storage]
|
||||
upload_dir = "./uploads"
|
||||
max_file_size = "10MB"
|
||||
|
||||
[rate_limit]
|
||||
# Redis 不可达时是否拒绝请求。生产环境必须设置为 true。
|
||||
# 可通过 ERP__RATE_LIMIT__FAIL_CLOSE=true 环境变量覆盖。
|
||||
fail_close = false
|
||||
|
||||
Reference in New Issue
Block a user