Solve issue with 'sslmode=verify-full' when there are multiple hosts
This commit is contained in:
committed by
Jack Christensen
parent
bacf81fb4e
commit
bf76d1ed51
@@ -297,7 +297,7 @@ func ParseConfig(connString string) (*Config, error) {
|
|||||||
tlsConfigs = append(tlsConfigs, nil)
|
tlsConfigs = append(tlsConfigs, nil)
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
tlsConfigs, err = configTLS(settings)
|
tlsConfigs, err = configTLS(settings, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &parseConfigError{connString: connString, msg: "failed to configure TLS", err: err}
|
return nil, &parseConfigError{connString: connString, msg: "failed to configure TLS", err: err}
|
||||||
}
|
}
|
||||||
@@ -552,8 +552,8 @@ func parseServiceSettings(servicefilePath, serviceName string) (map[string]strin
|
|||||||
// configTLS uses libpq's TLS parameters to construct []*tls.Config. It is
|
// configTLS uses libpq's TLS parameters to construct []*tls.Config. It is
|
||||||
// necessary to allow returning multiple TLS configs as sslmode "allow" and
|
// necessary to allow returning multiple TLS configs as sslmode "allow" and
|
||||||
// "prefer" allow fallback.
|
// "prefer" allow fallback.
|
||||||
func configTLS(settings map[string]string) ([]*tls.Config, error) {
|
func configTLS(settings map[string]string, thisHost string) ([]*tls.Config, error) {
|
||||||
host := settings["host"]
|
host := thisHost
|
||||||
sslmode := settings["sslmode"]
|
sslmode := settings["sslmode"]
|
||||||
sslrootcert := settings["sslrootcert"]
|
sslrootcert := settings["sslrootcert"]
|
||||||
sslcert := settings["sslcert"]
|
sslcert := settings["sslcert"]
|
||||||
|
|||||||
Reference in New Issue
Block a user