debug: add option to disable auth

This commit is contained in:
yusing 2025-02-20 17:45:47 +08:00
parent c66b17583f
commit dd6af9b8e0
2 changed files with 3 additions and 3 deletions

View file

@ -31,7 +31,7 @@ func GetDefaultAuth() Provider {
} }
func IsEnabled() bool { func IsEnabled() bool {
return common.APIJWTSecret != nil || IsOIDCEnabled() return !common.DebugDisableAuth && (common.APIJWTSecret != nil || IsOIDCEnabled())
} }
func IsOIDCEnabled() bool { func IsOIDCEnabled() bool {

View file

@ -20,8 +20,6 @@ var (
IsTrace = GetEnvBool("TRACE", false) && IsDebug IsTrace = GetEnvBool("TRACE", false) && IsDebug
IsProduction = !IsTest && !IsDebug IsProduction = !IsTest && !IsDebug
DebugMemLogger = GetEnvBool("DEBUG_MEM_LOGGER", false)
ProxyHTTPAddr, ProxyHTTPAddr,
ProxyHTTPHost, ProxyHTTPHost,
ProxyHTTPPort, ProxyHTTPPort,
@ -44,6 +42,8 @@ var (
APIUser = GetEnvString("API_USER", "admin") APIUser = GetEnvString("API_USER", "admin")
APIPassword = GetEnvString("API_PASSWORD", "password") APIPassword = GetEnvString("API_PASSWORD", "password")
DebugDisableAuth = GetEnvBool("DEBUG_DISABLE_AUTH", false)
// OIDC Configuration. // OIDC Configuration.
OIDCIssuerURL = GetEnvString("OIDC_ISSUER_URL", "") OIDCIssuerURL = GetEnvString("OIDC_ISSUER_URL", "")
OIDCLogoutURL = GetEnvString("OIDC_LOGOUT_URL", "") OIDCLogoutURL = GetEnvString("OIDC_LOGOUT_URL", "")