Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't error out in case home cannot be found #1318

Merged
merged 1 commit into from
Mar 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cmd/notary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ func (n *notaryCommander) parseConfig() (*viper.Viper, error) {
// Get home directory for current user
homeDir, err := homedir.Dir()
if err != nil {
return nil, fmt.Errorf("cannot get current user home directory: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we should specify that the default notary directory instead will be $(pwd)/.notary maybe, as part of the warning, since we are still setting a default, it just may be in an unexpected place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see what you mean, can definitely change that 😉

}
if homeDir == "" {
return nil, fmt.Errorf("cannot get current user home directory")
logrus.Warnf("cannot get current user home directory: %v", err)
pwd, _ := os.Getwd()
logrus.Warnf("notary will use %s to store configuration and keys", filepath.Join(pwd, configDir))
}

config := viper.New()
Expand Down