From 817151cf15eb37dbc37dbdc82216e38b053400d9 Mon Sep 17 00:00:00 2001 From: Eric Ladner Date: Sat, 7 Jun 2025 20:39:17 -0500 Subject: [PATCH] add sslmode option (default: disable) to PG connect string --- Plugins/SQL/Targets/PostgreSQL.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/SQL/Targets/PostgreSQL.cpp b/Plugins/SQL/Targets/PostgreSQL.cpp index 4926845663a..3c3574d2507 100644 --- a/Plugins/SQL/Targets/PostgreSQL.cpp +++ b/Plugins/SQL/Targets/PostgreSQL.cpp @@ -34,6 +34,7 @@ void PostgreSQL::Connect() const std::string host = "host=" + Config::Get("HOST", "localhost"); const std::string user = "user=" + *Config::Get("USERNAME"); const std::string pass = "password=" + *Config::Get("PASSWORD"); + const std::string sslmode = "sslmode=" + Config::Get("SSL_MODE", "disable"); // Database technically is optional. If not given, it will connect to the default // database of the given USERNAME. @@ -47,7 +48,7 @@ void PostgreSQL::Connect() const std::string port = "port=" + Config::Get("PORT", "5432"); // Build the m_connection string - this is used later in the PQping (PQping doesn't need the password). - m_connectString = host + " " + port + " " + db + " " + user ; + m_connectString = host + " " + port + " " + db + " " + user + " " + sslmode; // hide the password in the log file LOG_INFO("Connect String: %s password=xxxxxxxx", m_connectString);