Files
Logan.Li 83a3630404
CI / backend (push) Canceled after 0s
feat(settings): 运行配置中心——.env 业务参数统一到后台页面维护
- 新增 app_configs 表与 appconfig 注册表:读取优先级 页面 → .env → 默认,删除即回退
- 页面可配 7 项:支付回调基址、成功回跳、Webhook 密钥(加密入库)、未验签放行开关、CORS、可信代理、GeoIP 路径
- 引导密钥(JWT_SECRET / OPSLIC_MASTER_KEY / OFFLINE_LICENSE_SEED)与部署参数只读展示掩码+指纹,永不入库
- 校验:URL 格式、密钥长度≥16、CIDR、release 下禁止开启未验签回调;变更写审计日志
- 消费点改造:支付回调地址、Waffo 回跳、webhook 验签、可信代理、CORS、GeoIP 统一走配置中心
- 前端新增「审计与设置 → 运行配置」页(分组表格 + 来源标记 + 编辑弹窗 + 恢复默认)
- .env.example 补注释:哪些必须留在 .env、哪些已收敛到页面
2026-11-01 06:17:58 +08:00

52 lines
2.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
// 运行配置中心(后台「系统设置 → 运行配置」)的请求/响应结构。
// 机密项只回显掩码 + 指纹,永不回传明文。 // Logan.Li
// RuntimeItemView 单个配置项视图 // Logan.Li
type RuntimeItemView struct {
Key string `json:"key"`
Label string `json:"label"`
Group string `json:"group"`
Description string `json:"description"`
Kind string `json:"kind"` // string / bool / list / secret
Value string `json:"value"` // 非机密项的当前生效值
Masked string `json:"masked"` // 展示用值(机密项为掩码)
Source string `json:"source"` // page / env / default / missing
Default string `json:"default"` // 注册表默认值
Editable bool `json:"editable"` // 是否可页面编辑
RequiresRestart bool `json:"requires_restart"` // 是否需重启生效
Danger bool `json:"danger"` // 高风险开关
ReadOnlyReason string `json:"read_only_reason"`
Placeholder string `json:"placeholder"`
Configured bool `json:"configured"` // 当前是否有生效值
Fingerprint string `json:"fingerprint"` // 机密项指纹(SHA256 前 4 字节 hex)
UpdatedAt string `json:"updated_at"`
UpdatedBy string `json:"updated_by"`
}
// RuntimeGroupView 分组视图 // Logan.Li
type RuntimeGroupView struct {
Name string `json:"name"`
Items []RuntimeItemView `json:"items"`
}
// RuntimeConfigUpdate 批量保存(空字符串表示清除页面值、回退环境变量/默认) // Logan.Li
type RuntimeConfigUpdate struct {
Values map[string]string `json:"values"`
}
// RuntimeResetRequest 恢复默认(删除页面值,回退环境变量/默认) // Logan.Li
type RuntimeResetRequest struct {
Keys []string `json:"keys"`
}
// RuntimeOverview 配置中心总览 // Logan.Li
type RuntimeOverview struct {
Groups []RuntimeGroupView `json:"groups"`
// BootstrapKeys 必须留在 .env 的引导密钥键名(页面只读展示) // Logan.Li
BootstrapKeys []string `json:"bootstrap_keys"`
// PageEditableKeys 可在页面维护的键名(.env 里可以删掉) // Logan.Li
PageEditableKeys []string `json:"page_editable_keys"`
}