Skip to content

Commit

Permalink
cmd: fix password shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Aug 28, 2023
1 parent 0aa1b38 commit 8c665ca
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmd/hostd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,22 @@ func mustSetAPIPassword(log *zap.Logger) {
log.Fatal("API password must be set via environment variable or config file when --env flag is set")
}

var pass string
for {
fmt.Println("Please choose a password to unlock the UI and API.")
fmt.Println("(The password must be at least 4 characters.)")
pass, err := readPasswordInput("Enter password")
var err error
cfg.HTTP.Password, err = readPasswordInput("Enter password")
if err != nil {
log.Fatal("Could not read password", zap.Error(err))
}

if len(pass) >= 4 {
if len(cfg.HTTP.Password) >= 4 {
break
}

fmt.Println("\033[31mPassword must be at least 4 characters!\033[0m")
fmt.Println("")
}
cfg.HTTP.Password = pass
}

func mustGetSeedPhrase(log *zap.Logger) string {
Expand Down

0 comments on commit 8c665ca

Please sign in to comment.