PMM-9541 Fix database discover when using socket (#118)

When discovering databases and using local socket connection add
trailing "/" to the database name to omit using it as a host for
the connection.
This commit is contained in:
Oleksii 2023-05-08 15:24:25 +03:00 committed by GitHub
parent aec5cf01b1
commit c3fbc44358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,11 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
}
if dsnURI != nil {
dsnURI.Path = databaseName
if dsnURI.Host == "" && strings.HasPrefix(dsnURI.Path, "/") {
dsnURI.Path = "/" + databaseName
} else {
dsnURI.Path = databaseName
}
dsn = dsnURI.String()
} else {
// replacing one dbname with another is complicated.