mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 14:54:05 +00:00
Handle k8s in healthcheck.go
This commit is contained in:
parent
18ae6fa6c1
commit
4fb43034cd
1 changed files with 10 additions and 1 deletions
|
@ -11,12 +11,17 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
isFreeBSD := runtime.GOOS == "freebsd"
|
||||
|
||||
// Is K8S + uptime-kuma as the container name
|
||||
// See #2083
|
||||
isK8s := strings.HasPrefix(os.Getenv("UPTIME_KUMA_PORT"), "tcp://")
|
||||
|
||||
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
|
@ -44,7 +49,11 @@ func main() {
|
|||
hostname = "127.0.0.1"
|
||||
}
|
||||
|
||||
port := os.Getenv("UPTIME_KUMA_PORT")
|
||||
port := ""
|
||||
// UPTIME_KUMA_PORT is override by K8S unexpectedly,
|
||||
if !isK8s {
|
||||
port = os.Getenv("UPTIME_KUMA_PORT")
|
||||
}
|
||||
if len(port) == 0 {
|
||||
port = os.Getenv("PORT")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue