fix util for splitting host and port

Now you can provide both a default host and a default port
This commit is contained in:
Marcus Efraimsson
2019-02-04 13:10:32 +01:00
parent eb8dfefb23
commit d433ca7d40
6 changed files with 121 additions and 88 deletions

View File

@@ -242,10 +242,7 @@ func (ss *SqlStore) buildConnectionString() (string, error) {
cnnstr += ss.buildExtraConnectionString('&')
case migrator.POSTGRES:
host, port, err := util.SplitIPPort(ss.dbCfg.Host, "5432")
if err != nil {
return "", err
}
host, port := util.SplitHostPortDefault(ss.dbCfg.Host, "127.0.0.1", "5432")
if ss.dbCfg.Pwd == "" {
ss.dbCfg.Pwd = "''"
}