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) }