Production state

This commit is contained in:
2026-07-13 01:26:49 +08:00
parent 7cb409f5a6
commit 8c6e6a54cc
21 changed files with 769 additions and 76 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"fmt"
"net/http"
"os"
"time"
)
func main() {
if len(os.Args) != 2 {
fmt.Fprintln(os.Stderr, "usage: healthcheck URL")
os.Exit(2)
}
client := &http.Client{Timeout: 2 * time.Second}
response, err := client.Get(os.Args[1])
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
fmt.Fprintln(os.Stderr, response.Status)
os.Exit(1)
}
}