@@ -20,12 +20,12 @@ import (
20
20
// HTTPStats is a listener for presenting the server $SYS stats on a JSON http endpoint.
21
21
type HTTPStats struct {
22
22
sync.RWMutex
23
- id string // the internal id of the listener
24
- address string // the network address to bind to
25
- config * Config // configuration values for the listener
26
- listen * http.Server // the http server
27
- sysInfo * system.Info // pointers to the server data
28
- end uint32 // ensure the close methods are only called once
23
+ id string // the internal id of the listener
24
+ address string // the network address to bind to
25
+ config * Config // configuration values for the listener
26
+ listen * http.Server // the http server
27
+ sysInfo * system.Info // pointers to the server data
28
+ end uint32 // ensure the close methods are only called once
29
29
handlers Handlers
30
30
}
31
31
@@ -79,6 +79,9 @@ func (l *HTTPStats) Protocol() string {
79
79
// Init initializes the listener.
80
80
func (l * HTTPStats ) Init (_ * slog.Logger ) error {
81
81
mux := http .NewServeMux ()
82
+ for path , handler := range l .handlers {
83
+ mux .HandleFunc (path , handler )
84
+ }
82
85
mux .HandleFunc ("/" , l .jsonHandler )
83
86
l .listen = & http.Server {
84
87
ReadTimeout : 5 * time .Second ,
0 commit comments