Config: avoid adding default configs if entries present (#2426)

This commit is contained in:
poornas
2018-04-03 13:09:32 -07:00
committed by Dee Koder
parent 8aaf909a08
commit 18ddd3925b
+7 -2
View File
@@ -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`.")