refactor httpd
This commit is contained in:
parent
7c17c971a0
commit
515e910683
2 changed files with 6 additions and 6 deletions
|
@ -13,10 +13,11 @@ import (
|
||||||
"gopkg.in/mcuadros/go-syslog.v2/format"
|
"gopkg.in/mcuadros/go-syslog.v2/format"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: return a server
|
func setupHTTP(hub circolog.Hub) *http.ServeMux {
|
||||||
func setupHTTP(hub circolog.Hub) {
|
mux := http.NewServeMux()
|
||||||
http.HandleFunc("/", getHTTPHandler(hub))
|
mux.HandleFunc("/", getHTTPHandler(hub))
|
||||||
http.HandleFunc("/ws", getWSHandler(hub))
|
mux.HandleFunc("/ws", getWSHandler(hub))
|
||||||
|
return mux
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseParameterL(r *http.Request) (int, error) {
|
func parseParameterL(r *http.Request) (int, error) {
|
|
@ -59,8 +59,7 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
setupHTTP(hub)
|
httpServer := http.Server{Handler: setupHTTP(hub)}
|
||||||
httpServer := http.Server{Handler: nil}
|
|
||||||
if *querySocket != "" {
|
if *querySocket != "" {
|
||||||
fmt.Printf("Binding address `%s` [http]\n", *querySocket)
|
fmt.Printf("Binding address `%s` [http]\n", *querySocket)
|
||||||
unixListener, err := net.Listen("unix", *querySocket)
|
unixListener, err := net.Listen("unix", *querySocket)
|
||||||
|
|
Loading…
Reference in a new issue