From 42d54a418d05192e2f19c443e4ac3c5594340a5e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 28 Oct 2024 08:08:27 -0500 Subject: [PATCH] quit with configSave() Signed-off-by: Jeff Carr --- http.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/http.go b/http.go index 2dddeb4..f260143 100644 --- a/http.go +++ b/http.go @@ -3,6 +3,7 @@ package main import ( "fmt" "net/http" + "os" "strings" pb "go.wit.com/lib/protobuf/virtbuf" @@ -145,6 +146,17 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } + if route == "/quit" { + log.Warn("writing out config file and exiting virtigo") + fmt.Fprintln(w, "writing out config file and exiting virtigo") + if err := me.cluster.ConfigSave(); err != nil { + log.Info("configsave error", err) + } else { + os.Exit(-1) + } + return + } + log.Warn("BAD URL =", route) fmt.Fprintln(w, "BAD URL tmp =", route) }