Allow setting ssh connection key file, fix connection ui

This commit is contained in:
Dan Sosedoff
2017-09-26 23:29:28 -05:00
parent bf423658af
commit 5e22795828
9 changed files with 67 additions and 32 deletions

View File

@@ -14,14 +14,14 @@ import (
)
type Bookmark struct {
Url string `json:"url"` // Postgres connection URL
Host string `json:"host"` // Server hostname
Port int `json:"port"` // Server port
User string `json:"user"` // Database user
Password string `json:"password"` // User password
Database string `json:"database"` // Database name
Ssl string `json:"ssl"` // Connection SSL mode
Ssh shared.SSHInfo `json:"ssh"` // SSH tunnel config
Url string `json:"url"` // Postgres connection URL
Host string `json:"host"` // Server hostname
Port int `json:"port"` // Server port
User string `json:"user"` // Database user
Password string `json:"password"` // User password
Database string `json:"database"` // Database name
Ssl string `json:"ssl"` // Connection SSL mode
Ssh *shared.SSHInfo `json:"ssh"` // SSH tunnel config
}
func (b Bookmark) SSHInfoIsEmpty() bool {
@@ -71,6 +71,10 @@ func readServerConfig(path string) (Bookmark, error) {
bookmark.Ssl = "disable"
}
if bookmark.Ssh != nil && bookmark.Ssh.Port == "" {
bookmark.Ssh.Port = "22"
}
return bookmark, err
}

View File

@@ -95,12 +95,12 @@ func Test_GetBookmark(t *testing.T) {
}
func Test_Bookmark_SSHInfoIsEmpty(t *testing.T) {
emptySSH := shared.SSHInfo{
emptySSH := &shared.SSHInfo{
Host: "",
Port: "",
User: "",
}
populatedSSH := shared.SSHInfo{
populatedSSH := &shared.SSHInfo{
Host: "localhost",
Port: "8080",
User: "postgres",