Revert "refactor: fix check for empty string"

This reverts commit 949198d09e.
This commit is contained in:
mohit-nagaraj 2024-10-11 15:11:13 +05:30
parent dcb675a343
commit 9684d34ad0
No known key found for this signature in database

View file

@ -32,20 +32,20 @@ func main() {
} }
sslKey := os.Getenv("UPTIME_KUMA_SSL_KEY") sslKey := os.Getenv("UPTIME_KUMA_SSL_KEY")
if sslKey == "" { if len(sslKey) == 0 {
sslKey = os.Getenv("SSL_KEY") sslKey = os.Getenv("SSL_KEY")
} }
sslCert := os.Getenv("UPTIME_KUMA_SSL_CERT") sslCert := os.Getenv("UPTIME_KUMA_SSL_CERT")
if sslCert == "" { if len(sslCert) == 0 {
sslCert = os.Getenv("SSL_CERT") sslCert = os.Getenv("SSL_CERT")
} }
hostname := os.Getenv("UPTIME_KUMA_HOST") hostname := os.Getenv("UPTIME_KUMA_HOST")
if hostname == "" && !isFreeBSD { if len(hostname) == 0 && !isFreeBSD {
hostname = os.Getenv("HOST") hostname = os.Getenv("HOST")
} }
if hostname == "" { if len(hostname) == 0 {
hostname = "127.0.0.1" hostname = "127.0.0.1"
} }
@ -54,15 +54,15 @@ func main() {
if !isK8s { if !isK8s {
port = os.Getenv("UPTIME_KUMA_PORT") port = os.Getenv("UPTIME_KUMA_PORT")
} }
if port == "" { if len(port) == 0 {
port = os.Getenv("PORT") port = os.Getenv("PORT")
} }
if port == "" { if len(port) == 0 {
port = "3001" port = "3001"
} }
protocol := "" protocol := ""
if sslKey != "" && sslCert != "" { if len(sslKey) != 0 && len(sslCert) != 0 {
protocol = "https" protocol = "https"
} else { } else {
protocol = "http" protocol = "http"