fix #3 userprivatekeyfile flag not always working

This commit is contained in:
Samuel Lorch 2022-01-19 14:58:51 +01:00
parent 0449e9983c
commit fa4d395a02

View file

@ -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)
}
}