mirror of
https://github.com/yusing/godoxy.git
synced 2025-07-15 01:54:03 +02:00
env: remove LOG_STREAMING and DEBUG_MEM_LOGGER
This commit is contained in:
parent
7093985b57
commit
14bb66d12f
1 changed files with 14 additions and 7 deletions
|
@ -15,13 +15,9 @@ import (
|
||||||
var (
|
var (
|
||||||
prefixes = []string{"GODOXY_", "GOPROXY_", ""}
|
prefixes = []string{"GODOXY_", "GOPROXY_", ""}
|
||||||
|
|
||||||
IsTest = GetEnvBool("TEST", false) || strings.HasSuffix(os.Args[0], ".test")
|
IsTest = GetEnvBool("TEST", false) || strings.HasSuffix(os.Args[0], ".test")
|
||||||
IsDebug = GetEnvBool("DEBUG", IsTest)
|
IsDebug = GetEnvBool("DEBUG", IsTest)
|
||||||
IsTrace = GetEnvBool("TRACE", false) && IsDebug
|
IsTrace = GetEnvBool("TRACE", false) && IsDebug
|
||||||
IsProduction = !IsTest && !IsDebug
|
|
||||||
|
|
||||||
EnableLogStreaming = GetEnvBool("LOG_STREAMING", true)
|
|
||||||
DebugMemLogger = GetEnvBool("DEBUG_MEM_LOGGER", false) && EnableLogStreaming
|
|
||||||
|
|
||||||
ProxyHTTPAddr,
|
ProxyHTTPAddr,
|
||||||
ProxyHTTPHost,
|
ProxyHTTPHost,
|
||||||
|
@ -55,6 +51,13 @@ var (
|
||||||
OIDCScopes = GetEnvString("OIDC_SCOPES", "openid, profile, email")
|
OIDCScopes = GetEnvString("OIDC_SCOPES", "openid, profile, email")
|
||||||
OIDCAllowedUsers = GetCommaSepEnv("OIDC_ALLOWED_USERS", "")
|
OIDCAllowedUsers = GetCommaSepEnv("OIDC_ALLOWED_USERS", "")
|
||||||
OIDCAllowedGroups = GetCommaSepEnv("OIDC_ALLOWED_GROUPS", "")
|
OIDCAllowedGroups = GetCommaSepEnv("OIDC_ALLOWED_GROUPS", "")
|
||||||
|
|
||||||
|
// metrics configuration
|
||||||
|
MetricsDisableCPU = GetEnvBool("METRICS_DISABLE_CPU", false)
|
||||||
|
MetricsDisableMemory = GetEnvBool("METRICS_DISABLE_MEMORY", false)
|
||||||
|
MetricsDisableDisk = GetEnvBool("METRICS_DISABLE_DISK", false)
|
||||||
|
MetricsDisableNetwork = GetEnvBool("METRICS_DISABLE_NETWORK", false)
|
||||||
|
MetricsDisableSensors = GetEnvBool("METRICS_DISABLE_SENSORS", false)
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetEnv[T any](key string, defaultValue T, parser func(string) (T, error)) T {
|
func GetEnv[T any](key string, defaultValue T, parser func(string) (T, error)) T {
|
||||||
|
@ -87,6 +90,10 @@ func GetEnvBool(key string, defaultValue bool) bool {
|
||||||
return GetEnv(key, defaultValue, strconv.ParseBool)
|
return GetEnv(key, defaultValue, strconv.ParseBool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetEnvInt(key string, defaultValue int) int {
|
||||||
|
return GetEnv(key, defaultValue, strconv.Atoi)
|
||||||
|
}
|
||||||
|
|
||||||
func GetAddrEnv(key, defaultValue, scheme string) (addr, host, port, fullURL string) {
|
func GetAddrEnv(key, defaultValue, scheme string) (addr, host, port, fullURL string) {
|
||||||
addr = GetEnvString(key, defaultValue)
|
addr = GetEnvString(key, defaultValue)
|
||||||
if addr == "" {
|
if addr == "" {
|
||||||
|
|
Loading…
Add table
Reference in a new issue