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
+1 -4
View File
@@ -49,10 +49,7 @@ func generateConnectionString(datasource *models.DataSource) (string, error) {
}
}
server, port, err := util.SplitIPPort(datasource.Url, "1433")
if err != nil {
return "", err
}
server, port := util.SplitHostPortDefault(datasource.Url, "localhost", "1433")
encrypt := datasource.JsonData.Get("encrypt").MustString("false")
connStr := fmt.Sprintf("server=%s;port=%s;database=%s;user id=%s;password=%s;",