config -- Avoid deleting existing dns section if someone removes schema_version from yaml file.
This commit is contained in:
parent
3ad4b2864d
commit
250cc0ec0f
|
@ -72,6 +72,7 @@ var config = configuration{
|
|||
{Filter: dnsfilter.Filter{ID: 3}, Enabled: false, URL: "https://hosts-file.net/ad_servers.txt", Name: "hpHosts - Ad and Tracking servers only"},
|
||||
{Filter: dnsfilter.Filter{ID: 4}, Enabled: false, URL: "http://www.malwaredomainlist.com/hostslist/hosts.txt", Name: "MalwareDomainList.com Hosts List"},
|
||||
},
|
||||
SchemaVersion: currentSchemaVersion,
|
||||
}
|
||||
|
||||
// Loads configuration from the YAML file
|
||||
|
|
|
@ -126,8 +126,10 @@ func upgradeSchema1to2(diskConfig *map[string]interface{}) error {
|
|||
}
|
||||
}
|
||||
|
||||
if _, ok := (*diskConfig)["dns"]; !ok {
|
||||
(*diskConfig)["dns"] = (*diskConfig)["coredns"]
|
||||
delete((*diskConfig), "coredns")
|
||||
}
|
||||
(*diskConfig)["schema_version"] = 2
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue