Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Added checking the value of set password flag (expressed by usage '…
Browse files Browse the repository at this point in the history
…-p' or `SNAP_REST_PASSWORD` env var)
  • Loading branch information
IzabellaRaulin committed Jun 22, 2017
1 parent ed43eb6 commit c5c37bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/snaptel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func checkTribeCommand(ctx *cli.Context) error {
// Checks for authentication flags and returns a username/password
// from the specified settings
func checkForAuth(ctx *cli.Context) (username, password string) {
if ctx.IsSet("password") {
if ctx.Bool("password") {
username = "snap" // for now since username is unused but needs to exist for basicAuth
// Prompt for password
fmt.Print("Password:")
Expand All @@ -143,6 +143,7 @@ func checkForAuth(ctx *cli.Context) (username, password string) {
fmt.Println(err)
}
if cfg.RestAPI.Password != nil {
// use password declared in config file
password = *cfg.RestAPI.Password
} else {
fmt.Println("Error config password field 'rest-auth-pwd' is empty")
Expand Down

0 comments on commit c5c37bb

Please sign in to comment.