Move status HTTP handlers into prog/weaver/http.go

This commit is contained in:
Adam Harrison authored and Matthias Radestock committed 2015-08-11 12:01:27 +01:00
1 parent 278807a199
commit 00ecff09f7
3 files changed
+46 -22

No files matched your search

+1 -21
View File
@@ -317,27 +317,7 @@ func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator
router.HandleHTTP(muxRouter)
muxRouter.Methods("GET").Path("/status").Headers("Accept", "application/json").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
json, _ := router.StatusJSON(version)
w.Header().Set("Content-Type", "application/json")
w.Write(json)
})
muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "weave router", version)
fmt.Fprintln(w, router.Status())
if allocator != nil {
fmt.Fprintln(w, allocator.String())
fmt.Fprintln(w, "Allocator default subnet:", defaultSubnet)
}
fmt.Fprintln(w, "")
if dnsserver == nil {
fmt.Fprintln(w, "WeaveDNS is disabled")
} else {
fmt.Fprintln(w, dnsserver.String())
fmt.Fprintln(w, ns.String())
}
})
HandleHTTP(muxRouter, router, allocator, defaultSubnet, ns, dnsserver)
http.Handle("/", muxRouter)