mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
Add support for Unix domain sockets.
This adds a new configuration option, socket-path, instead of using host.
This commit is contained in:
parent
c0b74f298a
commit
3468a8cb8a
@ -665,6 +665,8 @@ datastore:
|
|||||||
host: "localhost"
|
host: "localhost"
|
||||||
# port is unnecessary for connections via unix domain socket:
|
# port is unnecessary for connections via unix domain socket:
|
||||||
#port: 3306
|
#port: 3306
|
||||||
|
# if socket-path is set, it will be used instead of host:port
|
||||||
|
#socket-path: "/var/run/mysqld/mysqld.sock"
|
||||||
user: "oragono"
|
user: "oragono"
|
||||||
password: "hunter2"
|
password: "hunter2"
|
||||||
history-database: "oragono_history"
|
history-database: "oragono_history"
|
||||||
|
@ -12,6 +12,7 @@ type Config struct {
|
|||||||
Enabled bool
|
Enabled bool
|
||||||
Host string
|
Host string
|
||||||
Port int
|
Port int
|
||||||
|
SocketPath string `yaml:"socket-path"`
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
HistoryDatabase string `yaml:"history-database"`
|
HistoryDatabase string `yaml:"history-database"`
|
||||||
|
@ -88,7 +88,9 @@ func (mysql *MySQL) getExpireTime() (expireTime time.Duration) {
|
|||||||
|
|
||||||
func (m *MySQL) Open() (err error) {
|
func (m *MySQL) Open() (err error) {
|
||||||
var address string
|
var address string
|
||||||
if m.config.Port != 0 {
|
if m.config.SocketPath != "" {
|
||||||
|
address = fmt.Sprintf("unix(%s)", m.config.SocketPath)
|
||||||
|
} else 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,6 +686,8 @@ datastore:
|
|||||||
host: "localhost"
|
host: "localhost"
|
||||||
# port is unnecessary for connections via unix domain socket:
|
# port is unnecessary for connections via unix domain socket:
|
||||||
#port: 3306
|
#port: 3306
|
||||||
|
# if socket-path is set, it will be used instead of host:port
|
||||||
|
#socket-path: "/var/run/mysqld/mysqld.sock"
|
||||||
user: "oragono"
|
user: "oragono"
|
||||||
password: "hunter2"
|
password: "hunter2"
|
||||||
history-database: "oragono_history"
|
history-database: "oragono_history"
|
||||||
|
Loading…
Reference in New Issue
Block a user