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:
Sean Chittenden 2016-04-23 17:18:18 -07:00
parent 70ae7f73b4
commit e7f600b4e6
1 changed files with 2 additions and 1 deletions

View File

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