mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Merge pull request #1 from mohit-nagaraj/deepsource-autofix-1bba350f
refactor: fix check for empty string
This commit is contained in:
commit
adb5cbe425
1 changed files with 7 additions and 7 deletions
|
@ -32,20 +32,20 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sslKey := os.Getenv("UPTIME_KUMA_SSL_KEY")
|
sslKey := os.Getenv("UPTIME_KUMA_SSL_KEY")
|
||||||
if len(sslKey) == 0 {
|
if sslKey == "" {
|
||||||
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 len(sslCert) == 0 {
|
if sslCert == "" {
|
||||||
sslCert = os.Getenv("SSL_CERT")
|
sslCert = os.Getenv("SSL_CERT")
|
||||||
}
|
}
|
||||||
|
|
||||||
hostname := os.Getenv("UPTIME_KUMA_HOST")
|
hostname := os.Getenv("UPTIME_KUMA_HOST")
|
||||||
if len(hostname) == 0 && !isFreeBSD {
|
if hostname == "" && !isFreeBSD {
|
||||||
hostname = os.Getenv("HOST")
|
hostname = os.Getenv("HOST")
|
||||||
}
|
}
|
||||||
if len(hostname) == 0 {
|
if hostname == "" {
|
||||||
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 len(port) == 0 {
|
if port == "" {
|
||||||
port = os.Getenv("PORT")
|
port = os.Getenv("PORT")
|
||||||
}
|
}
|
||||||
if len(port) == 0 {
|
if port == "" {
|
||||||
port = "3001"
|
port = "3001"
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol := ""
|
protocol := ""
|
||||||
if len(sslKey) != 0 && len(sslCert) != 0 {
|
if sslKey != "" && sslCert != "" {
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
} else {
|
} else {
|
||||||
protocol = "http"
|
protocol = "http"
|
||||||
|
|
Loading…
Reference in a new issue