api: add DEBUG_DISABLE_AUTH for debugging

This commit is contained in:
yusing 2025-03-28 07:17:59 +08:00
parent 9cb7cc84ee
commit 78a3c8a8e4
2 changed files with 2 additions and 1 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

@ -44,6 +44,7 @@ var (
APIJWTTokenTTL = GetDurationEnv("API_JWT_TOKEN_TTL", time.Hour) APIJWTTokenTTL = GetDurationEnv("API_JWT_TOKEN_TTL", time.Hour)
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", "")