Allow keyfile to be absolute path
This commit is contained in:
parent
bd62b21d6e
commit
2983f5018b
|
@ -89,8 +89,13 @@ func genKey() *Key {
|
|||
}
|
||||
|
||||
func LoadKey(keyFile string) (*Key, error) {
|
||||
filePath := keyFile
|
||||
|
||||
if !strings.HasPrefix(keyFile, "/") && !strings.HasPrefix(keyFile, ".") {
|
||||
rootDir := viper.GetString(cli.HomeFlag)
|
||||
filePath := path.Join(rootDir, keyFile)
|
||||
filePath = path.Join(rootDir, keyFile)
|
||||
}
|
||||
|
||||
keyJSONBytes, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue