1
0
Fork 0
forked from forgejo/forgejo

Fix incorrect PostgreSQL connection string for Unix sockets (#28865)

Fix #28864
This commit is contained in:
sdvcrx 2024-01-21 00:04:47 +08:00 committed by GitHub
parent 6c771a311b
commit 80d48621cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -169,8 +169,8 @@ func getPostgreSQLConnectionString(dbHost, dbUser, dbPasswd, dbName, dbsslMode s
RawQuery: dbParam,
}
query := connURL.Query()
if strings.HasPrefix(dbHost, "/") { // looks like a unix socket
query.Add("host", dbHost)
if strings.HasPrefix(host, "/") { // looks like a unix socket
query.Add("host", host)
connURL.Host = ":" + port
}
query.Set("sslmode", dbsslMode)