mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-14 07:59:31 +01:00
Add support for Unix domain sockets.
This commit is contained in:
parent
d5cec62df3
commit
475ec9fb24
@ -67,6 +67,8 @@ func (m *MySQL) Open() (err error) {
|
|||||||
var address string
|
var address string
|
||||||
if m.config.Port != 0 {
|
if m.config.Port != 0 {
|
||||||
address = fmt.Sprintf("tcp(%s:%d)", m.config.Host, m.config.Port)
|
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))
|
m.db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@%s/%s", m.config.User, m.config.Password, address, m.config.HistoryDatabase))
|
||||||
|
Loading…
Reference in New Issue
Block a user