v0.5.0-rc5: added proxy.exclude label, refactored some code

This commit is contained in:
yusing
2024-09-17 17:56:41 +08:00
parent 83d1d027c6
commit be7a766cb2
8 changed files with 31 additions and 24 deletions

View File

@@ -2,17 +2,13 @@ package common
import (
"os"
"strings"
U "github.com/yusing/go-proxy/utils"
)
var NoSchemaValidation = getEnvBool("GOPROXY_NO_SCHEMA_VALIDATION")
var IsDebug = getEnvBool("GOPROXY_DEBUG")
func getEnvBool(key string) bool {
switch strings.ToLower(os.Getenv(key)) {
case "1", "true", "yes", "on":
return true
default:
return false
}
return U.ParseBool(os.Getenv(key))
}