2018-08-25 13:55:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
2024-04-04 20:58:35 +00:00
|
|
|
#include <Common/SSHWrapper.h>
|
2018-08-25 13:55:18 +00:00
|
|
|
#include <Core/Protocol.h>
|
|
|
|
#include <IO/ConnectionTimeouts.h>
|
2024-04-04 20:58:35 +00:00
|
|
|
|
|
|
|
#include <string>
|
2018-08-25 13:55:18 +00:00
|
|
|
|
2019-06-03 00:57:33 +00:00
|
|
|
namespace Poco::Util
|
2018-08-25 13:55:18 +00:00
|
|
|
{
|
2019-06-03 00:57:33 +00:00
|
|
|
class AbstractConfiguration;
|
2018-08-25 13:55:18 +00:00
|
|
|
}
|
|
|
|
|
2019-06-03 00:57:33 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2018-08-25 13:55:18 +00:00
|
|
|
struct ConnectionParameters
|
|
|
|
{
|
2019-06-03 00:57:33 +00:00
|
|
|
std::string host;
|
2019-01-19 23:27:52 +00:00
|
|
|
UInt16 port{};
|
2019-06-03 00:57:33 +00:00
|
|
|
std::string default_database;
|
|
|
|
std::string user;
|
|
|
|
std::string password;
|
2022-08-03 19:44:08 +00:00
|
|
|
std::string quota_key;
|
2024-04-04 20:58:35 +00:00
|
|
|
SSHKey ssh_private_key;
|
2019-01-19 23:27:52 +00:00
|
|
|
Protocol::Secure security = Protocol::Secure::Disable;
|
|
|
|
Protocol::Compression compression = Protocol::Compression::Enable;
|
2018-08-25 13:55:18 +00:00
|
|
|
ConnectionTimeouts timeouts;
|
|
|
|
|
2022-03-11 18:16:49 +00:00
|
|
|
ConnectionParameters() = default;
|
2023-11-13 02:31:56 +00:00
|
|
|
ConnectionParameters(const Poco::Util::AbstractConfiguration & config, std::string host);
|
2022-03-10 19:41:03 +00:00
|
|
|
ConnectionParameters(const Poco::Util::AbstractConfiguration & config, std::string host, std::optional<UInt16> port);
|
2022-01-27 06:19:02 +00:00
|
|
|
|
2023-11-13 02:31:56 +00:00
|
|
|
static UInt16 getPortFromConfig(const Poco::Util::AbstractConfiguration & config, std::string connection_host);
|
2023-06-19 03:57:38 +00:00
|
|
|
|
|
|
|
/// Ask to enter the user's password if password option contains this value.
|
|
|
|
/// "\n" is used because there is hardly a chance that a user would use '\n' as password.
|
|
|
|
static constexpr std::string_view ASK_PASSWORD = "\n";
|
2018-08-25 13:55:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|