Skip to content

Commit

Permalink
fix(init): remove access key prompt (#2519)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codelax authored Sep 20, 2022
1 parent 6aff878 commit 2eb02be
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions internal/namespaces/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,6 @@ Default path for configuration file is based on the following priority order:
// Manually prompt for missing args:

// Credentials
if args.AccessKey == "" {
_, _ = interactive.Println()
args.AccessKey, err = promptAccessKey(ctx)
if err != nil {
return err
}
}

if args.SecretKey == "" {
_, _ = interactive.Println()
args.SecretKey, err = promptSecret(ctx)
Expand Down Expand Up @@ -386,36 +378,6 @@ func promptSecret(ctx context.Context) (string, error) {
}
}

func promptAccessKey(ctx context.Context) (string, error) {
accessKey, err := interactive.Readline(&interactive.ReadlineConfig{
Ctx: ctx,
PromptFunc: func(value string) string {
accessKey := "access-key"
switch {
case validation.IsUUID(value):
accessKey = terminal.Style(accessKey, color.FgBlue)
}
return terminal.Style(fmt.Sprintf("Enter a valid %s: ", accessKey), color.Bold)
},
ValidateFunc: func(s string) error {
if validation.IsAccessKey(s) {
return nil
}
return fmt.Errorf("invalid access-key")
},
})
if err != nil {
return "", err
}

switch {
case validation.IsAccessKey(accessKey):
return accessKey, nil
default:
return "", fmt.Errorf("invalid access-key: '%v'", accessKey)
}
}

const logo = `
@@@@@@@@@@@@@@@.
@@@@@@@@@@@@@@@@@@@@ __ __ _
Expand Down

0 comments on commit 2eb02be

Please sign in to comment.