fix(storage/mysql): add missing port to the address

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2021-04-26 11:09:52 +02:00
parent df9fc78d2d
commit e2b56d0a09
No known key found for this signature in database
GPG key ID: 31AB0439F4C5C90E

View file

@ -242,6 +242,10 @@ func (s *MySQL) open(logger log.Logger) (*conn, error) {
if s.Host[0] != '/' { if s.Host[0] != '/' {
cfg.Net = "tcp" cfg.Net = "tcp"
cfg.Addr = s.Host cfg.Addr = s.Host
if s.Port != 0 {
cfg.Addr = net.JoinHostPort(s.Host, strconv.Itoa(int(s.Port)))
}
} else { } else {
cfg.Net = "unix" cfg.Net = "unix"
cfg.Addr = s.Host cfg.Addr = s.Host