✨ feat(status): 新增请求日志并重设计状态页
- 新增 server.request_log 配置:记录业务请求元数据(IP/方法/路径/状态/耗时, key 自动脱敏)与 4xx/5xx 错误摘要(前 4KB),按保留天数自动清理 - 移除 /self-info 与 /vacuum 接口及相关文档 - 状态页重设计:毛玻璃卡片+吸顶玻璃栏、服务状态条、KPI 卡与请求分类 条形图、可折叠 API 文档分组、行内测试面板;深浅色分别调校, 含 reduced-motion / reduced-transparency / 无 backdrop-filter 兜底
This commit is contained in:
1 parent
bf49805bb6
commit
bfb4290c15
11 files changed
+1060
-838
No files matched your search
@@ -19,11 +19,18 @@ type Config struct {
|
||||
|
||||
// ServerConfig 服务器配置
|
||||
type ServerConfig struct {
|
||||
Port string `mapstructure:"port"`
|
||||
Host string `mapstructure:"host"`
|
||||
AccessKey string `mapstructure:"access_key"`
|
||||
ProtectAll bool `mapstructure:"protect_all"` // 业务接口也要求访问密钥(公网部署建议开启)
|
||||
RateLimitQPS float64 `mapstructure:"rate_limit_qps"` // 每 IP 每秒请求上限,0=不限制
|
||||
Port string `mapstructure:"port"`
|
||||
Host string `mapstructure:"host"`
|
||||
AccessKey string `mapstructure:"access_key"`
|
||||
ProtectAll bool `mapstructure:"protect_all"` // 业务接口也要求访问密钥(公网部署建议开启)
|
||||
RateLimitQPS float64 `mapstructure:"rate_limit_qps"` // 每 IP 每秒请求上限,0=不限制
|
||||
RequestLog RequestLogConfig `mapstructure:"request_log"` // 请求日志(只记元数据与错误摘要)
|
||||
}
|
||||
|
||||
// RequestLogConfig 请求日志配置
|
||||
type RequestLogConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"` // 是否记录业务接口请求元数据
|
||||
RetentionDays int `mapstructure:"retention_days"` // 日志保留天数,<=0 视为 7
|
||||
}
|
||||
|
||||
// FanqieConfig 番茄小说配置
|
||||
@@ -152,6 +159,8 @@ func setDefaults() {
|
||||
// 服务器配置
|
||||
viper.SetDefault("server.port", "40180")
|
||||
viper.SetDefault("server.host", "0.0.0.0")
|
||||
viper.SetDefault("server.request_log.enabled", false)
|
||||
viper.SetDefault("server.request_log.retention_days", 7)
|
||||
|
||||
// 番茄小说配置
|
||||
viper.SetDefault("fanqie.algorithm", "gorgon")
|
||||
|
||||
Reference in new issue
Block a user