From 9b15554c5104c49d2673077305d79b4dced1d193 Mon Sep 17 00:00:00 2001 From: divyam234 <47589864+divyam234@users.noreply.github.com> Date: Sun, 30 Mar 2025 16:35:43 +0200 Subject: [PATCH] respect sslmode set by user --- pgconn/config.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pgconn/config.go b/pgconn/config.go index d7a0fefb..926cb980 100644 --- a/pgconn/config.go +++ b/pgconn/config.go @@ -665,7 +665,9 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P if sslnegotiation == "direct" { tlsConfig.NextProtos = []string{"postgresql"} - sslmode = "require" + if sslmode == "prefer" { + sslmode = "require" + } } if sslrootcert != "" {