Skip to content

Commit

Permalink
fix: moved the variables to the createTemplateAuthRule function for l…
Browse files Browse the repository at this point in the history
…ocalization

Signed-off-by: Abinand P <[email protected]>
  • Loading branch information
Abiji-2020 committed Oct 31, 2024
1 parent e030302 commit c377749
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cyctl/internal/create/template_auth_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ cyctl create templateauthrule demo-templateauthrule --repo='https://github.com/c
)

var (
username string
password string
usernameName string
passwordName string
usernameKey string
passwordKey string
username string
password string
)

func getTeamplateAuthRulesFromPromt() (string, string, string, string, string, error) {
Expand Down Expand Up @@ -110,7 +106,7 @@ func validateSecretKeySelector(username, password string) (string, string, strin
if usernameName == "" || usernameKey == "" || passwordName == "" || passwordKey == "" {
return "", "", "", "", fmt.Errorf("invalid format for username or password. Expected 'name:key'")
}

return usernameName, usernameKey, passwordName, passwordKey, nil
}

Expand All @@ -124,6 +120,13 @@ func splitNameKey(input string) (string, string) {

// createTemplateAuthRule allows you to create TemplateAuthRule Custom Resource.
func createTemplateAuthRule(clientset *client.CyclopsV1Alpha1Client, templateAuthRuleName string) {
var (
usernameName string
passwordName string
usernameKey string
passwordKey string
)

if username == "" && password == "" && repo == "" {
var err error
usernameName, usernameKey, passwordName, passwordKey, repo, err = getTeamplateAuthRulesFromPromt()
Expand Down

0 comments on commit c377749

Please sign in to comment.