3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

Merge pull request #1013 from ajaspers/mysql

Add support for Unix domain sockets
This commit is contained in:
Shivaram Lingamneni 2020-05-16 19:58:34 -07:00 committed by GitHub
commit 045dd89c41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,8 @@ func (m *MySQL) Open() (err error) {
var address string
if m.config.Port != 0 {
address = fmt.Sprintf("tcp(%s:%d)", m.config.Host, m.config.Port)
} else {
address = fmt.Sprintf("unix(%s)", m.config.Host)
}
m.db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@%s/%s", m.config.User, m.config.Password, address, m.config.HistoryDatabase))