Create Hosts object after the enable option has been checked.

This commit is contained in:
kenshinx 2015-10-13 23:29:28 +08:00
parent d0956e90f5
commit 3f70c993a8
1 changed files with 4 additions and 1 deletions

View File

@ -73,7 +73,10 @@ func NewHandler() *GODNSHandler {
panic("Invalid cache backend")
}
hosts := NewHosts(settings.Hosts, settings.Redis)
var hosts Hosts
if settings.Hosts.Enable {
hosts = NewHosts(settings.Hosts, settings.Redis)
}
return &GODNSHandler{resolver, cache, negCache, hosts}
}