mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
Add files via upload
This commit is contained in:
@@ -60,14 +60,24 @@ func main() {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
http.HandleFunc("/kontakt", enableCORS(func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/kontakt", enableCORS(func(w http.ResponseWriter, r *http.Request) {
|
||||||
// Run make dev in the kontakt directory
|
// Check if kontakt service is already running
|
||||||
cmd := exec.Command("make", "dev")
|
resp, err := http.Get("http://localhost:8081/health")
|
||||||
cmd.Dir = "kontakt"
|
if err == nil && resp.StatusCode == 200 {
|
||||||
err := cmd.Start()
|
http.Redirect(w, r, "http://localhost:8081/", http.StatusFound)
|
||||||
if err != nil {
|
return
|
||||||
log.Printf("Error running make dev: %v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start the service if not running
|
||||||
|
cmd := exec.Command("make", "dev")
|
||||||
|
cmd.Dir = "kontakt"
|
||||||
|
err = cmd.Start()
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Failed to start kontakt service", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait briefly for service to start
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
http.Redirect(w, r, "http://localhost:8081/", http.StatusFound)
|
http.Redirect(w, r, "http://localhost:8081/", http.StatusFound)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user