From 18ddd3925b366a730fdce63da303aefa7c25814e Mon Sep 17 00:00:00 2001 From: poornas Date: Tue, 3 Apr 2018 13:09:32 -0700 Subject: [PATCH] Config: avoid adding default configs if entries present (#2426) --- cmd/config-migrate.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/config-migrate.go b/cmd/config-migrate.go index 7164a3da..35a92bcc 100644 --- a/cmd/config-migrate.go +++ b/cmd/config-migrate.go @@ -453,12 +453,14 @@ func migrateConfigV8ToV9() { } cfgV9 := newConfigV9() + isEmpty := true // We dropped alias support in v8. We only need to migrate host configs. for host, hostCfgV8 := range mcCfgV8.Data().(*configV8).Hosts { // Ignore 'player', 'play' and 'dl' aliases. if host == "player" || host == "dl" || host == "play" { continue } + isEmpty = false hostCfgV9 := hostConfigV9{} hostCfgV9.URL = hostCfgV8.URL hostCfgV9.AccessKey = hostCfgV8.AccessKey @@ -467,8 +469,11 @@ func migrateConfigV8ToV9() { hostCfgV9.Lookup = "auto" cfgV9.Hosts[host] = hostCfgV9 } - // Load default settings. - cfgV9.loadDefaults() + if isEmpty { + // Load default settings. + cfgV9.loadDefaults() + } + mcNewCfgV9, e := quick.New(cfgV9) fatalIf(probe.NewError(e), "Unable to initialize quick config for config version `9`.")