Append ssl mode to url if ssl flag is set and not defined in the url

This commit is contained in:
Dan Sosedoff 2014-10-30 19:30:34 -05:00
parent e032315195
commit 61ecc9e9a1

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"os/signal" "os/signal"
"strings"
) )
const VERSION = "0.3.1" const VERSION = "0.3.1"
@ -38,7 +39,13 @@ func exitWithMessage(message string) {
func getConnectionString() string { func getConnectionString() string {
if options.Url != "" { if options.Url != "" {
return options.Url url := options.Url
if options.Ssl != "" && !strings.Contains(url, "sslmode") {
url += fmt.Sprintf("?sslmode=%s", options.Ssl)
}
return url
} }
str := fmt.Sprintf( str := fmt.Sprintf(