feat: add debug log stream support
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 构建信息
|
||||
var (
|
||||
Mode string = "debug"
|
||||
@@ -9,4 +14,32 @@ var (
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user