Let people connect with just a hostname
This commit is contained in:
parent
ee35fe61af
commit
15e3b9b4c0
@ -4,6 +4,7 @@ package postgresql
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
@ -192,6 +193,9 @@ func New(opts ...options.Option) (store.Store, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(dataSourceName, " ") {
|
||||||
|
dataSourceName = fmt.Sprintf("host=%s", dataSourceName)
|
||||||
|
}
|
||||||
db, err := sql.Open(driver, dataSourceName)
|
db, err := sql.Open(driver, dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user