Let people connect with just a hostname

This commit is contained in:
Jake Sanders 2019-11-01 15:16:05 +00:00
parent ee35fe61af
commit 15e3b9b4c0

View File

@ -4,6 +4,7 @@ package postgresql
import (
"database/sql"
"fmt"
"strings"
"time"
"unicode"
@ -192,6 +193,9 @@ func New(opts ...options.Option) (store.Store, error) {
if err != nil {
return nil, err
}
if !strings.Contains(dataSourceName, " ") {
dataSourceName = fmt.Sprintf("host=%s", dataSourceName)
}
db, err := sql.Open(driver, dataSourceName)
if err != nil {
return nil, err