Skip to content

add sslmode option (default: disable) to PG connect string #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Plugins/SQL/Targets/PostgreSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void PostgreSQL::Connect()
const std::string host = "host=" + Config::Get<std::string>("HOST", "localhost");
const std::string user = "user=" + *Config::Get<std::string>("USERNAME");
const std::string pass = "password=" + *Config::Get<std::string>("PASSWORD");
const std::string sslmode = "sslmode=" + Config::Get<std::string>("SSL_MODE", "disable");

// Database technically is optional. If not given, it will connect to the default
// database of the given USERNAME.
Expand All @@ -47,7 +48,7 @@ void PostgreSQL::Connect()
const std::string port = "port=" + Config::Get<std::string>("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);
Expand Down