每日清理
This commit is contained in:
@@ -79,10 +79,11 @@ type QueueConfig struct {
|
||||
|
||||
// LoggingConfig 日志配置
|
||||
type LoggingConfig struct {
|
||||
Level string `mapstructure:"level"` // debug, info, warn, error
|
||||
Development bool `mapstructure:"development"` // 启用开发模式(美化输出)
|
||||
AppLog LogRotationConfig `mapstructure:"app_log"` // 应用日志配置
|
||||
AccessLog LogRotationConfig `mapstructure:"access_log"` // HTTP 访问日志配置
|
||||
Level string `mapstructure:"level"` // debug, info, warn, error
|
||||
Development bool `mapstructure:"development"` // 启用开发模式(美化输出)
|
||||
AppLog LogRotationConfig `mapstructure:"app_log"` // 应用日志配置
|
||||
AccessLog LogRotationConfig `mapstructure:"access_log"` // HTTP 访问日志配置
|
||||
RetentionLog LogRotationConfig `mapstructure:"retention_log"` // Worker 日留存日志配置
|
||||
}
|
||||
|
||||
// LogRotationConfig Lumberjack 日志轮转配置
|
||||
@@ -168,7 +169,7 @@ type GatewayConfig struct {
|
||||
type WorkerConfig struct {
|
||||
Role string `mapstructure:"role"` // Worker 运行角色:all、leader、consumer
|
||||
InstanceName string `mapstructure:"instance_name"` // Worker 实例名称,用于多实例日志区分
|
||||
AuditRetentionCleanupEnabled bool `mapstructure:"audit_retention_cleanup_enabled"` // 是否启用审计日志月度物理清理
|
||||
AuditRetentionCleanupEnabled bool `mapstructure:"audit_retention_cleanup_enabled"` // 是否启用审计日志物理清理
|
||||
}
|
||||
|
||||
// ApprovalConfig 审批新旧入口切换配置。
|
||||
@@ -291,12 +292,18 @@ func (c *Config) Validate() error {
|
||||
if c.Logging.AccessLog.Filename == "" {
|
||||
return fmt.Errorf("invalid configuration: logging.access_log.filename: must be non-empty valid file path")
|
||||
}
|
||||
if c.Logging.RetentionLog.Filename == "" {
|
||||
return fmt.Errorf("invalid configuration: logging.retention_log.filename: must be non-empty valid file path")
|
||||
}
|
||||
if c.Logging.AppLog.MaxSize < 1 || c.Logging.AppLog.MaxSize > 1000 {
|
||||
return fmt.Errorf("invalid configuration: logging.app_log.max_size: size out of range (current value: %d, expected: 1-1000 MB)", c.Logging.AppLog.MaxSize)
|
||||
}
|
||||
if c.Logging.AccessLog.MaxSize < 1 || c.Logging.AccessLog.MaxSize > 1000 {
|
||||
return fmt.Errorf("invalid configuration: logging.access_log.max_size: size out of range (current value: %d, expected: 1-1000 MB)", c.Logging.AccessLog.MaxSize)
|
||||
}
|
||||
if c.Logging.RetentionLog.MaxSize < 1 || c.Logging.RetentionLog.MaxSize > 1000 {
|
||||
return fmt.Errorf("invalid configuration: logging.retention_log.max_size: size out of range (current value: %d, expected: 1-1000 MB)", c.Logging.RetentionLog.MaxSize)
|
||||
}
|
||||
|
||||
// 中间件验证
|
||||
if c.Middleware.RateLimiter.Max <= 0 {
|
||||
|
||||
Reference in New Issue
Block a user