From ee2230601734aa771ab1894658ac3ac58fa8344e Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 8 Aug 2024 16:10:26 -0700 Subject: [PATCH] address linter concerns --- internal/cli/cli.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 941c6bb6e05..56cf13fa363 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -227,11 +227,12 @@ func Parse() { } if config.Opts.DisableLocalAuth() { - if config.Opts.OAuth2Provider() == "" && config.Opts.AuthProxyHeader() == "" { + switch { + case config.Opts.OAuth2Provider() == "" && config.Opts.AuthProxyHeader() == "": printErrorAndExit(errors.New("DISABLE_LOCAL_AUTH is enabled but neither OAUTH2_PROVIDER nor AUTH_PROXY_HEADER is not set. Please enable at least one authentication source")) - } else if config.Opts.OAuth2Provider() != "" && !config.Opts.IsOAuth2UserCreationAllowed() { + case config.Opts.OAuth2Provider() != "" && !config.Opts.IsOAuth2UserCreationAllowed(): printErrorAndExit(errors.New("DISABLE_LOCAL_AUTH is enabled and an OAUTH2_PROVIDER is configured, but OAUTH2_USER_CREATION is not enabled")) - } else if config.Opts.AuthProxyHeader() != "" && !config.Opts.IsAuthProxyUserCreationAllowed() { + case config.Opts.AuthProxyHeader() != "" && !config.Opts.IsAuthProxyUserCreationAllowed(): printErrorAndExit(errors.New("DISABLE_LOCAL_AUTH is enabled and an AUTH_PROXY_HEADER is configured, but AUTH_PROXY_USER_CREATION is not enabled")) } }