Skip to content

Commit

Permalink
fix #3 userprivatekeyfile flag not always working
Browse files Browse the repository at this point in the history
  • Loading branch information
speatzle committed Jan 19, 2022
1 parent 0449e99 commit fa4d395
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
}

0 comments on commit fa4d395

Please sign in to comment.