From c5c37bb27bb6d0e80a4489c5ffc8091d70649d80 Mon Sep 17 00:00:00 2001 From: Izabella Raulin Date: Thu, 22 Jun 2017 16:35:03 +0200 Subject: [PATCH] Added checking the value of set `password` flag (expressed by usage '-p' or `SNAP_REST_PASSWORD` env var) --- cmd/snaptel/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/snaptel/main.go b/cmd/snaptel/main.go index c0653c0d3..544aec610 100644 --- a/cmd/snaptel/main.go +++ b/cmd/snaptel/main.go @@ -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:") @@ -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")