Move bookmark default port parsing to readServerConfig func

This commit is contained in:
Dan Sosedoff
2016-11-15 22:01:42 -06:00
parent 59018287de
commit 0510634db7
2 changed files with 6 additions and 5 deletions

View File

@@ -49,6 +49,11 @@ func readServerConfig(path string) (Bookmark, error) {
}
_, err = toml.Decode(string(buff), &bookmark)
if bookmark.Port == 0 {
bookmark.Port = 5432
}
return bookmark, err
}
@@ -101,9 +106,5 @@ func GetBookmark(bookmarkPath string, bookmarkName string) (Bookmark, error) {
return Bookmark{}, fmt.Errorf("couldn't find a bookmark with name %s", bookmarkName)
}
if bookmark.Port == 0 {
bookmark.Port = 5432
}
return bookmark, nil
}