BuildConfigChangeDetails computes a redacted, human-readable list of config changes. Secrets are never printed; only structural or non-sensitive fields are surfaced.
(oldCfg, newCfg *config.Config)
| 12 | // BuildConfigChangeDetails computes a redacted, human-readable list of config changes. |
| 13 | // Secrets are never printed; only structural or non-sensitive fields are surfaced. |
| 14 | func BuildConfigChangeDetails(oldCfg, newCfg *config.Config) []string { |
| 15 | changes := make([]string, 0, 16) |
| 16 | if oldCfg == nil || newCfg == nil { |
| 17 | return changes |
| 18 | } |
| 19 | |
| 20 | // Simple scalars |
| 21 | if oldCfg.Port != newCfg.Port { |
| 22 | changes = append(changes, fmt.Sprintf("port: %d -> %d", oldCfg.Port, newCfg.Port)) |
| 23 | } |
| 24 | if oldCfg.AuthDir != newCfg.AuthDir { |
| 25 | changes = append(changes, fmt.Sprintf("auth-dir: %s -> %s", oldCfg.AuthDir, newCfg.AuthDir)) |
| 26 | } |
| 27 | if oldCfg.Debug != newCfg.Debug { |
| 28 | changes = append(changes, fmt.Sprintf("debug: %t -> %t", oldCfg.Debug, newCfg.Debug)) |
| 29 | } |
| 30 | if oldCfg.Pprof.Enable != newCfg.Pprof.Enable { |
| 31 | changes = append(changes, fmt.Sprintf("pprof.enable: %t -> %t", oldCfg.Pprof.Enable, newCfg.Pprof.Enable)) |
| 32 | } |
| 33 | if strings.TrimSpace(oldCfg.Pprof.Addr) != strings.TrimSpace(newCfg.Pprof.Addr) { |
| 34 | changes = append(changes, fmt.Sprintf("pprof.addr: %s -> %s", strings.TrimSpace(oldCfg.Pprof.Addr), strings.TrimSpace(newCfg.Pprof.Addr))) |
| 35 | } |
| 36 | if oldCfg.LoggingToFile != newCfg.LoggingToFile { |
| 37 | changes = append(changes, fmt.Sprintf("logging-to-file: %t -> %t", oldCfg.LoggingToFile, newCfg.LoggingToFile)) |
| 38 | } |
| 39 | if oldCfg.UsageStatisticsEnabled != newCfg.UsageStatisticsEnabled { |
| 40 | changes = append(changes, fmt.Sprintf("usage-statistics-enabled: %t -> %t", oldCfg.UsageStatisticsEnabled, newCfg.UsageStatisticsEnabled)) |
| 41 | } |
| 42 | if oldCfg.RedisUsageQueueRetentionSeconds != newCfg.RedisUsageQueueRetentionSeconds { |
| 43 | changes = append(changes, fmt.Sprintf("redis-usage-queue-retention-seconds: %d -> %d", oldCfg.RedisUsageQueueRetentionSeconds, newCfg.RedisUsageQueueRetentionSeconds)) |
| 44 | } |
| 45 | if oldCfg.DisableCooling != newCfg.DisableCooling { |
| 46 | changes = append(changes, fmt.Sprintf("disable-cooling: %t -> %t", oldCfg.DisableCooling, newCfg.DisableCooling)) |
| 47 | } |
| 48 | if oldCfg.SaveCooldownStatus != newCfg.SaveCooldownStatus { |
| 49 | changes = append(changes, fmt.Sprintf("save-cooldown-status: %t -> %t", oldCfg.SaveCooldownStatus, newCfg.SaveCooldownStatus)) |
| 50 | } |
| 51 | if oldCfg.TransientErrorCooldownSeconds != newCfg.TransientErrorCooldownSeconds { |
| 52 | changes = append(changes, fmt.Sprintf("transient-error-cooldown-seconds: %d -> %d", oldCfg.TransientErrorCooldownSeconds, newCfg.TransientErrorCooldownSeconds)) |
| 53 | } |
| 54 | if oldCfg.DisableClaudeCloakMode != newCfg.DisableClaudeCloakMode { |
| 55 | changes = append(changes, fmt.Sprintf("disable-claude-cloak-mode: %t -> %t", oldCfg.DisableClaudeCloakMode, newCfg.DisableClaudeCloakMode)) |
| 56 | } |
| 57 | if oldCfg.DisableImageGeneration != newCfg.DisableImageGeneration { |
| 58 | changes = append(changes, fmt.Sprintf("disable-image-generation: %v -> %v", oldCfg.DisableImageGeneration, newCfg.DisableImageGeneration)) |
| 59 | } |
| 60 | if strings.TrimSpace(oldCfg.GPTImage2BaseModel) != strings.TrimSpace(newCfg.GPTImage2BaseModel) { |
| 61 | changes = append(changes, fmt.Sprintf("gpt-image-2-base-model: %s -> %s", strings.TrimSpace(oldCfg.GPTImage2BaseModel), strings.TrimSpace(newCfg.GPTImage2BaseModel))) |
| 62 | } |
| 63 | if oldCfg.RequestLog != newCfg.RequestLog { |
| 64 | changes = append(changes, fmt.Sprintf("request-log: %t -> %t", oldCfg.RequestLog, newCfg.RequestLog)) |
| 65 | } |
| 66 | if oldCfg.LogsMaxTotalSizeMB != newCfg.LogsMaxTotalSizeMB { |
| 67 | changes = append(changes, fmt.Sprintf("logs-max-total-size-mb: %d -> %d", oldCfg.LogsMaxTotalSizeMB, newCfg.LogsMaxTotalSizeMB)) |
| 68 | } |
| 69 | if oldCfg.ErrorLogsMaxFiles != newCfg.ErrorLogsMaxFiles { |
| 70 | changes = append(changes, fmt.Sprintf("error-logs-max-files: %d -> %d", oldCfg.ErrorLogsMaxFiles, newCfg.ErrorLogsMaxFiles)) |
| 71 | } |