forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: reggie-k <[email protected]>
- Loading branch information
Showing
11 changed files
with
235 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,38 @@ | ||
package util | ||
|
||
import ( | ||
stderrors "errors" | ||
|
||
"github.com/argoproj/argo-cd/v3/util/errors" | ||
) | ||
|
||
var ( | ||
LogFormat string | ||
LogLevel string | ||
) | ||
|
||
func ValidateBearerTokenForHTTPSRepoOnly(bearerToken string, isHTTPS bool) { | ||
// Bearer token is only valid for HTTPS repositories | ||
if bearerToken != "" { | ||
if !isHTTPS { | ||
err := stderrors.New("--bearer-token is only supported for HTTPS repositories") | ||
errors.CheckError(err) | ||
} | ||
} | ||
} | ||
|
||
func ValidateBearerTokenForGitOnly(bearerToken string, repoType string) { | ||
// Bearer token is only valid for Git repositories | ||
if bearerToken != "" && repoType != "git" { | ||
err := stderrors.New("--bearer-token is only supported for Git repositories") | ||
errors.CheckError(err) | ||
} | ||
} | ||
|
||
func ValidateBearerTokenAndPasswordCombo(bearerToken string, password string) { | ||
// Either the password or the bearer token must be set, but not both | ||
if bearerToken != "" && password != "" { | ||
err := stderrors.New("only --bearer-token or --password is allowed, not both") | ||
errors.CheckError(err) | ||
} | ||
} |
Oops, something went wrong.