This commit is contained in:
OmarBazaraa 2021-07-28 15:28:30 +00:00
parent d8fb1cb0e0
commit 3a393042a2
2 changed files with 6 additions and 7 deletions

View File

@ -46,7 +46,7 @@ StorageMongoDB::StorageMongoDB(
, username(username_)
, password(password_)
, options(options_)
, uri("mongodb://" + username_ + ":" + password_ + "@" + host_ + ":" + std::to_string(port_) + "/" + database_name_ + "?" + options_)
, uri("mongodb://" + host_ + ":" + std::to_string(port_) + "/" + database_name_ + "?" + options_)
{
StorageInMemoryMetadata storage_metadata;
storage_metadata.setColumns(columns_);

View File

@ -17,11 +17,7 @@ namespace DB
Poco::Net::StreamSocket StorageMongoDBSocketFactory::createSocket(const std::string & host, int port, Poco::Timespan connectTimeout, bool secure)
{
#if USE_SSL
return secure ? createSecureSocket(host, port, connectTimeout) : createPlainSocket(host, port, connectTimeout);
#else
return createPlainSocket(host, port, connectTimeout);
#endif
}
Poco::Net::StreamSocket StorageMongoDBSocketFactory::createPlainSocket(const std::string & host, int port, Poco::Timespan connectTimeout)
@ -34,16 +30,19 @@ Poco::Net::StreamSocket StorageMongoDBSocketFactory::createPlainSocket(const std
return socket;
}
#if USE_SSL
Poco::Net::StreamSocket StorageMongoDBSocketFactory::createSecureSocket(const std::string & host, int port, Poco::Timespan connectTimeout)
{
#if USE_SSL
Poco::Net::SocketAddress address(host, port);
Poco::Net::SecureStreamSocket socket;
socket.connect(address, connectTimeout);
return socket;
}
#else
return createPlainSocket(host, port, connectTimeout);
#endif
}
}