mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-08 16:34:29 -04:00
Use default MySQL port if none is specified
This commit is contained in:
parent
bfea92e039
commit
aeeab5918c
1 changed files with 5 additions and 1 deletions
|
|
@ -52,7 +52,11 @@ func (d *Database) Open(logger *logging.Logger) (*icingadb.DB, error) {
|
|||
config.Addr = d.Host
|
||||
} else {
|
||||
config.Net = "tcp"
|
||||
config.Addr = net.JoinHostPort(d.Host, fmt.Sprint(d.Port))
|
||||
port := d.Port
|
||||
if port == 0 {
|
||||
port = 3306
|
||||
}
|
||||
config.Addr = net.JoinHostPort(d.Host, fmt.Sprint(port))
|
||||
}
|
||||
|
||||
config.DBName = d.Database
|
||||
|
|
|
|||
Loading…
Reference in a new issue