Add Healthcheck; Search missing immediately (#36)

This commit is contained in:
Mukhtar Akere
2025-01-31 23:45:30 +01:00
committed by GitHub
parent 92504cc8e0
commit 64995d0bf3
4 changed files with 44 additions and 9 deletions

22
cmd/healthcheck/main.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"cmp"
"net/http"
"os"
)
func main() {
port := cmp.Or(os.Getenv("QBIT_PORT"), "8282")
resp, err := http.Get("http://localhost:" + port + "/api/v2/app/version")
if err != nil {
os.Exit(1)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
os.Exit(1)
}
os.Exit(0)
}