From dd6af9b8e069299f5718f98d1a99284c817851c9 Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 20 Feb 2025 17:45:47 +0800 Subject: [PATCH] debug: add option to disable auth --- internal/api/v1/auth/auth.go | 2 +- internal/common/env.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/api/v1/auth/auth.go b/internal/api/v1/auth/auth.go index c579d4a..20afcbb 100644 --- a/internal/api/v1/auth/auth.go +++ b/internal/api/v1/auth/auth.go @@ -31,7 +31,7 @@ func GetDefaultAuth() Provider { } func IsEnabled() bool { - return common.APIJWTSecret != nil || IsOIDCEnabled() + return !common.DebugDisableAuth && (common.APIJWTSecret != nil || IsOIDCEnabled()) } func IsOIDCEnabled() bool { diff --git a/internal/common/env.go b/internal/common/env.go index 33d4743..7a10941 100644 --- a/internal/common/env.go +++ b/internal/common/env.go @@ -20,8 +20,6 @@ var ( IsTrace = GetEnvBool("TRACE", false) && IsDebug IsProduction = !IsTest && !IsDebug - DebugMemLogger = GetEnvBool("DEBUG_MEM_LOGGER", false) - ProxyHTTPAddr, ProxyHTTPHost, ProxyHTTPPort, @@ -44,6 +42,8 @@ var ( APIUser = GetEnvString("API_USER", "admin") APIPassword = GetEnvString("API_PASSWORD", "password") + DebugDisableAuth = GetEnvBool("DEBUG_DISABLE_AUTH", false) + // OIDC Configuration. OIDCIssuerURL = GetEnvString("OIDC_ISSUER_URL", "") OIDCLogoutURL = GetEnvString("OIDC_LOGOUT_URL", "")