mirror of https://github.com/mpolden/echoip
Log if template is unreadable
This commit is contained in:
parent
f34172761f
commit
ddc4d9e53c
|
@ -34,8 +34,12 @@ func main() {
|
|||
}
|
||||
|
||||
server := http.New(r)
|
||||
server.Template = opts.Template
|
||||
server.IPHeaders = opts.IPHeaders
|
||||
if _, err := os.Stat(opts.Template); err == nil {
|
||||
server.Template = opts.Template
|
||||
} else {
|
||||
log.Printf("Not configuring default handler: Template not found: %s", opts.Template)
|
||||
}
|
||||
if opts.ReverseLookup {
|
||||
log.Println("Enabling reverse lookup")
|
||||
server.LookupAddr = iputil.LookupAddr
|
||||
|
|
|
@ -308,7 +308,9 @@ func (s *Server) Handler() http.Handler {
|
|||
}
|
||||
|
||||
// Browser
|
||||
r.Route("GET", "/", s.DefaultHandler)
|
||||
if s.Template != "" {
|
||||
r.Route("GET", "/", s.DefaultHandler)
|
||||
}
|
||||
|
||||
// Port testing
|
||||
if s.LookupPort != nil {
|
||||
|
|
Loading…
Reference in New Issue