diff --git a/cmd/circologd/http.go b/cmd/circologd/http_log.go similarity index 95% rename from cmd/circologd/http.go rename to cmd/circologd/http_log.go index 5e58bc9..d9d21ee 100644 --- a/cmd/circologd/http.go +++ b/cmd/circologd/http_log.go @@ -13,10 +13,11 @@ import ( "gopkg.in/mcuadros/go-syslog.v2/format" ) -// TODO: return a server -func setupHTTP(hub circolog.Hub) { - http.HandleFunc("/", getHTTPHandler(hub)) - http.HandleFunc("/ws", getWSHandler(hub)) +func setupHTTP(hub circolog.Hub) *http.ServeMux { + mux := http.NewServeMux() + mux.HandleFunc("/", getHTTPHandler(hub)) + mux.HandleFunc("/ws", getWSHandler(hub)) + return mux } func parseParameterL(r *http.Request) (int, error) { diff --git a/cmd/circologd/main.go b/cmd/circologd/main.go index e3d2b8d..c554114 100644 --- a/cmd/circologd/main.go +++ b/cmd/circologd/main.go @@ -59,8 +59,7 @@ func main() { os.Exit(1) } - setupHTTP(hub) - httpServer := http.Server{Handler: nil} + httpServer := http.Server{Handler: setupHTTP(hub)} if *querySocket != "" { fmt.Printf("Binding address `%s` [http]\n", *querySocket) unixListener, err := net.Listen("unix", *querySocket)