mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
refactor(config): add detailed logging for legacy configuration migration
This commit is contained in:
@@ -376,9 +376,15 @@ func LoadConfigOptional(configFile string, optional bool) (*Config, error) {
|
|||||||
// Normalize OAuth provider model exclusion map.
|
// Normalize OAuth provider model exclusion map.
|
||||||
cfg.OAuthExcludedModels = NormalizeOAuthExcludedModels(cfg.OAuthExcludedModels)
|
cfg.OAuthExcludedModels = NormalizeOAuthExcludedModels(cfg.OAuthExcludedModels)
|
||||||
|
|
||||||
if cfg.legacyMigrationPending && !optional && configFile != "" {
|
if cfg.legacyMigrationPending {
|
||||||
if err := SaveConfigPreserveComments(configFile, &cfg); err != nil {
|
fmt.Println("Detected legacy configuration keys, attempting to persist the normalized config...")
|
||||||
return nil, fmt.Errorf("failed to persist migrated legacy config: %w", err)
|
if !optional && configFile != "" {
|
||||||
|
if err := SaveConfigPreserveComments(configFile, &cfg); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to persist migrated legacy config: %w", err)
|
||||||
|
}
|
||||||
|
fmt.Println("Legacy configuration normalized and persisted.")
|
||||||
|
} else {
|
||||||
|
fmt.Println("Legacy configuration normalized in memory; persistence skipped.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user