From 9d08114b9339e9be06c11040432790682e389de3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 29 Oct 2024 09:02:15 -0500 Subject: code reorg Signed-off-by: Jeff Carr --- http.go | 51 +++++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/http.go b/http.go index 857e117..8bb74b9 100644 --- a/http.go +++ b/http.go @@ -6,7 +6,6 @@ import ( "os" "strings" - pb "go.wit.com/lib/protobuf/virtbuf" "go.wit.com/lib/virtigoxml" "go.wit.com/log" ) @@ -21,43 +20,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { var route string route = cleanURL(r.URL.Path) - // show only what droplets should be running but are missing - if route == "/missing" { - var count int - var missing int - for _, d := range me.cluster.Droplets { - if d.StartState != pb.DropletState_ON { - continue - } - count += 1 - if d.CurrentState == pb.DropletState_ON { - continue - } - missing += 1 - fmt.Fprintln(w, d.Hostname, "current state:", d.CurrentState) - } - if missing == 0 { - fmt.Fprintln(w, "all", count, "droplets set to run are running") - } else { - fmt.Fprintln(w, missing, "droplets missing") - fmt.Fprintln(w, count, "droplets should be running") - } - return - } - - if route == "/favicon.ico" { - // w.Header().Set("Content-Type", "image/svg+xml") - w.Header().Set("Content-Type", "image/png") - writeFile(w, "ipv6.png") - return - } - - if route == "/goReference.svg" { - w.Header().Set("Content-Type", "image/svg+xml") - writeFile(w, "goReference.svg") - return - } - if route == "/uptime" { ok, s := uptimeCheck() if ok { @@ -143,6 +105,19 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } + if route == "/favicon.ico" { + // w.Header().Set("Content-Type", "image/svg+xml") + w.Header().Set("Content-Type", "image/png") + writeFile(w, "ipv6.png") + return + } + + if route == "/goReference.svg" { + w.Header().Set("Content-Type", "image/svg+xml") + writeFile(w, "goReference.svg") + return + } + log.Warn("BAD URL =", route) fmt.Fprintln(w, "BAD URL tmp =", route) } -- cgit v1.2.3