Skip to content

Commit c775fbc

Browse files
dveedenjulienschmidt
authored andcommitted
Use hostname from DSN as default for TLS if tls=true (#564)
1 parent 7df1717 commit c775fbc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dsn.go

+4
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ func parseDSNParams(cfg *Config, params string) (err error) {
494494
if boolValue {
495495
cfg.TLSConfig = "true"
496496
cfg.tls = &tls.Config{}
497+
host, _, err := net.SplitHostPort(cfg.Addr)
498+
if err == nil {
499+
cfg.tls.ServerName = host
500+
}
497501
} else {
498502
cfg.TLSConfig = "false"
499503
}

0 commit comments

Comments
 (0)