quit with configSave()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-28 08:08:27 -05:00
parent c12d3a2dbb
commit 42d54a418d
1 changed files with 12 additions and 0 deletions

12
http.go
View File

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"os"
"strings" "strings"
pb "go.wit.com/lib/protobuf/virtbuf" pb "go.wit.com/lib/protobuf/virtbuf"
@ -145,6 +146,17 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return 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) log.Warn("BAD URL =", route)
fmt.Fprintln(w, "BAD URL tmp =", route) fmt.Fprintln(w, "BAD URL tmp =", route)
} }