Improve error handling re: homedir expansion
Useful if the HOME envvar is not set because `vault` was launched in a clean environment (e.g. `env -i vault ...`).
This commit is contained in:
parent
70ae7f73b4
commit
e7f600b4e6
|
@ -53,9 +53,10 @@ func LoadConfig(path string) (*DefaultConfig, error) {
|
|||
path = v
|
||||
}
|
||||
|
||||
// NOTE: requires HOME env var to be set
|
||||
path, err := homedir.Expand(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error expanding config path: %s", err)
|
||||
return nil, fmt.Errorf("Error expanding config path %s: %s", path, err)
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadFile(path)
|
||||
|
|
Loading…
Reference in New Issue