mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-20 16:23:53 +01:00
24 lines
477 B
Go
24 lines
477 B
Go
package common
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var NoSchemaValidation = getEnvBool("GOPROXY_NO_SCHEMA_VALIDATION")
|
|
var IsDebug = getEnvBool("GOPROXY_DEBUG")
|
|
|
|
var LogLevel = func() logrus.Level {
|
|
if IsDebug {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
}
|
|
return logrus.GetLevel()
|
|
}()
|
|
|
|
func getEnvBool(key string) bool {
|
|
v := os.Getenv(key)
|
|
return v == "1" || strings.ToLower(v) == "true" || strings.ToLower(v) == "yes" || strings.ToLower(v) == "on"
|
|
}
|