From fa4d395a02557b13084aeaba4f8db3680c69a2a1 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Wed, 19 Jan 2022 14:58:51 +0100 Subject: [PATCH] fix #3 userprivatekeyfile flag not always working --- cmd/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index 6bb8971..8124213 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -97,7 +97,7 @@ func initConfig() { // Read in Private Key from File if userprivatekeyfile is set userprivatekeyfile, err := rootCmd.PersistentFlags().GetString("userPrivateKeyFile") - if err != nil && userprivatekeyfile != "" { + if err == nil && userprivatekeyfile != "" { if viper.GetBool("debug") { fmt.Fprintln(os.Stderr, "Loading Private Key from File:", userprivatekeyfile) } @@ -107,5 +107,7 @@ func initConfig() { os.Exit(1) } viper.Set("userprivatekey", string(content)) + } else if err != nil && viper.GetBool("debug") { + fmt.Fprintln(os.Stderr, "Getting Private Key File Flag:", err) } }