release: v0.1.3
This commit is contained in:
@@ -3,6 +3,7 @@ package conf
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// 构建信息
|
||||
@@ -17,23 +18,30 @@ var (
|
||||
|
||||
DebugProxy string = ""
|
||||
DebugSkipSSLVerify bool = false
|
||||
|
||||
runtimeDebugEnabled atomic.Bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
if !IsDebugMode() {
|
||||
return
|
||||
}
|
||||
|
||||
if proxy := os.Getenv("CKWK_DEBUG_PROXY"); proxy != "" {
|
||||
DebugProxy = proxy
|
||||
}
|
||||
DebugSkipSSLVerify = parseEnvBool("CKWK_DEBUG_SKIP_SSL_VERIFY")
|
||||
runtimeDebugEnabled.Store(parseEnvBool("CKWK_DEBUG_ENABLED"))
|
||||
}
|
||||
|
||||
func IsDebugMode() bool {
|
||||
func IsBuildDebugMode() bool {
|
||||
return !strings.EqualFold(Mode, "release")
|
||||
}
|
||||
|
||||
func IsRuntimeDebugEnabled() bool {
|
||||
return runtimeDebugEnabled.Load()
|
||||
}
|
||||
|
||||
func SetRuntimeDebugEnabled(enabled bool) {
|
||||
runtimeDebugEnabled.Store(enabled)
|
||||
}
|
||||
|
||||
func parseEnvBool(key string) bool {
|
||||
value := strings.TrimSpace(os.Getenv(key))
|
||||
switch strings.ToLower(value) {
|
||||
|
||||
Reference in New Issue
Block a user