forked from hswaw/hscloud
Allow disabling debug server
This commit is contained in:
parent
a509a47a50
commit
b27d528d69
1 changed files with 17 additions and 13 deletions
30
grpc.go
30
grpc.go
|
@ -123,21 +123,25 @@ func (s *server) serveForever() {
|
||||||
}()
|
}()
|
||||||
glog.Infof("Listening for GRPC on %v", s.opts.listenAddress)
|
glog.Infof("Listening for GRPC on %v", s.opts.listenAddress)
|
||||||
|
|
||||||
httpMux := http.NewServeMux()
|
if s.opts.debugAddress == "" {
|
||||||
httpMux.HandleFunc("/debug/status", statusz.StatusHandler)
|
glog.Info("Disabling debug HTTP server")
|
||||||
httpMux.HandleFunc("/debug/requests", trace.Traces)
|
} else {
|
||||||
httpMux.HandleFunc("/", statusz.StatusHandler)
|
httpMux := http.NewServeMux()
|
||||||
|
httpMux.HandleFunc("/debug/status", statusz.StatusHandler)
|
||||||
|
httpMux.HandleFunc("/debug/requests", trace.Traces)
|
||||||
|
httpMux.HandleFunc("/", statusz.StatusHandler)
|
||||||
|
|
||||||
if err := s.setupDebugHTTP(httpMux); err != nil {
|
if err := s.setupDebugHTTP(httpMux); err != nil {
|
||||||
glog.Exitf("Could not setup HTTP server: %v", err)
|
glog.Exitf("Could not setup HTTP server: %v", err)
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
if err := s.http.server.Serve(s.http.listen); err != nil {
|
|
||||||
glog.Exitf("Could not start HTTP server: %v", err)
|
|
||||||
}
|
}
|
||||||
}()
|
|
||||||
glog.Infof("Listening for HTTP on %v", s.opts.debugAddress)
|
go func() {
|
||||||
|
if err := s.http.server.Serve(s.http.listen); err != nil {
|
||||||
|
glog.Exitf("Could not start HTTP server: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
glog.Infof("Listening for HTTP on %v", s.opts.debugAddress)
|
||||||
|
}
|
||||||
|
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue