Startup notification (#250)

Stop the caddy message and start our own init notifications.
Log the version of CoreDNS when starting up.
Fix all middleware's setup functions so that return the error prefixed
with *which* middleware was failing; leads to better debuggable errors
when starting up.
This commit is contained in:
Miek Gieben 2016-09-10 09:16:25 +01:00 committed by GitHub
parent 5216ab6b58
commit 2dd8a687b3
19 changed files with 82 additions and 34 deletions

View file

@ -5,6 +5,7 @@ import (
"net"
"github.com/miekg/coredns/core/dnsserver"
"github.com/miekg/coredns/middleware"
"github.com/mholt/caddy"
)
@ -13,11 +14,11 @@ func setupBind(c *caddy.Controller) error {
config := dnsserver.GetConfig(c)
for c.Next() {
if !c.Args(&config.ListenHost) {
return c.ArgErr()
return middleware.Error("bind", c.ArgErr())
}
}
if net.ParseIP(config.ListenHost) == nil {
return fmt.Errorf("not a valid IP address: %s", config.ListenHost)
return middleware.Error("bind", fmt.Errorf("not a valid IP address: %s", config.ListenHost))
}
return nil
}