From 35974fa96d9b30a6af0b419d45ee1ef9c6075095 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Tue, 15 Oct 2024 18:01:17 -0400 Subject: Add start, stop, restart handlers --- api/api.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/api.go b/api/api.go index eaceb3d..3aba924 100644 --- a/api/api.go +++ b/api/api.go @@ -66,13 +66,28 @@ func VttRedirect(w http.ResponseWriter, req *http.Request) { } func VttStart(w http.ResponseWriter, req *http.Request) { + if startVtt(req.Context()) != nil { + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) } func VttStop(w http.ResponseWriter, req *http.Request) { + if stopVtt(req.Context()) != nil { + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) } func VttRestart(w http.ResponseWriter, req *http.Request) { + if restartVtt(req.Context()) != nil { + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusOK) } func VttLogs(w http.ResponseWriter, req *http.Request) { -- cgit v1.2.3