Files
wk-backend/internal/conf/var.go

46 lines
771 B
Go

package conf
import (
"os"
"strings"
)
// 构建信息
var (
Mode string = "debug"
Version string = "unknown"
BuildAt string = "unknown"
GitAuthor string = "unknown"
GitEmail string = "unknown"
GitCommit string = "unknown"
DebugProxy string = ""
DebugSkipSSLVerify bool = false
)
func init() {
if !IsDebugMode() {
return
}
if proxy := os.Getenv("CKWK_DEBUG_PROXY"); proxy != "" {
DebugProxy = proxy
}
DebugSkipSSLVerify = parseEnvBool("CKWK_DEBUG_SKIP_SSL_VERIFY")
}
func IsDebugMode() bool {
return !strings.EqualFold(Mode, "release")
}
func parseEnvBool(key string) bool {
value := strings.TrimSpace(os.Getenv(key))
switch strings.ToLower(value) {
case "1", "true", "yes", "on":
return true
default:
return false
}
}