Merge pull request #56638 from chhetripradeep/pchhetri/enable-secure-flag-for-clickhouse-cloud

Enable --secure flag for clickhouse-client for hostnames pointing to clickhouse cloud
This commit is contained in:
robot-clickhouse-ci-2 2023-11-13 00:30:58 +01:00 committed by GitHub
commit 9bceafbf9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,8 @@ ConnectionParameters::ConnectionParameters(const Poco::Util::AbstractConfigurati
, port(connection_port.value_or(getPortFromConfig(config)))
{
bool is_secure = config.getBool("secure", false);
security = is_secure ? Protocol::Secure::Enable : Protocol::Secure::Disable;
bool is_clickhouse_cloud = connection_host.ends_with(".clickhouse.cloud") || connection_host.ends_with(".clickhouse-staging.com");
security = (is_secure || is_clickhouse_cloud) ? Protocol::Secure::Enable : Protocol::Secure::Disable;
default_database = config.getString("database", "");