refactor remote mount
This commit is contained in:
parent
18929038fb
commit
ad4e950005
@ -198,9 +198,9 @@ template <> struct adl_serializer<repertory::remote::remote_config> {
|
|||||||
{"ApiPort", value.api_port},
|
{"ApiPort", value.api_port},
|
||||||
{"EncryptionToken", value.encryption_token},
|
{"EncryptionToken", value.encryption_token},
|
||||||
{"HostNameOrIp", value.host_name_or_ip},
|
{"HostNameOrIp", value.host_name_or_ip},
|
||||||
|
{"MaxConnections", value.max_connections},
|
||||||
{"ReceiveTimeoutMs", value.recv_timeout_ms},
|
{"ReceiveTimeoutMs", value.recv_timeout_ms},
|
||||||
{"SendTimeoutMs", value.send_timeout_ms},
|
{"SendTimeoutMs", value.send_timeout_ms},
|
||||||
{"MaxConnections", value.max_connections},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,9 +209,9 @@ template <> struct adl_serializer<repertory::remote::remote_config> {
|
|||||||
data.at("ApiPort").get_to(value.api_port);
|
data.at("ApiPort").get_to(value.api_port);
|
||||||
data.at("EncryptionToken").get_to(value.encryption_token);
|
data.at("EncryptionToken").get_to(value.encryption_token);
|
||||||
data.at("HostNameOrIp").get_to(value.host_name_or_ip);
|
data.at("HostNameOrIp").get_to(value.host_name_or_ip);
|
||||||
|
data.at("MaxConnections").get_to(value.max_connections);
|
||||||
data.at("ReceiveTimeoutMs").get_to(value.recv_timeout_ms);
|
data.at("ReceiveTimeoutMs").get_to(value.recv_timeout_ms);
|
||||||
data.at("SendTimeoutMs").get_to(value.send_timeout_ms);
|
data.at("SendTimeoutMs").get_to(value.send_timeout_ms);
|
||||||
data.at("MaxConnections").get_to(value.max_connections);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NLOHMANN_JSON_NAMESPACE_END
|
NLOHMANN_JSON_NAMESPACE_END
|
||||||
|
@ -423,6 +423,24 @@ auto app_config::get_value_by_name(const std::string &name) const
|
|||||||
return download_type_to_string(download_type_from_string(
|
return download_type_to_string(download_type_from_string(
|
||||||
preferred_download_type_, download_type::fallback));
|
preferred_download_type_, download_type::fallback));
|
||||||
}
|
}
|
||||||
|
if (name == "RemoteConfig.ApiPort") {
|
||||||
|
return std::to_string(get_remote_config().api_port);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.EncryptionToken") {
|
||||||
|
return get_remote_config().encryption_token;
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.HostNameOrIp") {
|
||||||
|
return get_remote_config().host_name_or_ip;
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.MaxConnections") {
|
||||||
|
return std::to_string(get_remote_config().max_connections);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.ReceiveTimeoutMs") {
|
||||||
|
return std::to_string(get_remote_config().recv_timeout_ms);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.SendTimeoutMs") {
|
||||||
|
return std::to_string(get_remote_config().send_timeout_ms);
|
||||||
|
}
|
||||||
if (name == "RemoteMount.Enable") {
|
if (name == "RemoteMount.Enable") {
|
||||||
return utils::string::from_bool(get_enable_remote_mount());
|
return utils::string::from_bool(get_enable_remote_mount());
|
||||||
}
|
}
|
||||||
@ -790,6 +808,42 @@ auto app_config::set_value_by_name(const std::string &name,
|
|||||||
download_type_from_string(value, download_type::fallback));
|
download_type_from_string(value, download_type::fallback));
|
||||||
return download_type_to_string(get_preferred_download_type());
|
return download_type_to_string(get_preferred_download_type());
|
||||||
}
|
}
|
||||||
|
if (name == "RemoteConfig.ApiPort") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.api_port = utils::string::to_uint16(value);
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return std::to_string(get_remote_config().api_port);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.EncryptionToken") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.encryption_token = value;
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return get_remote_config().encryption_token;
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.HostNameOrIp") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.host_name_or_ip = value;
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return get_remote_config().host_name_or_ip;
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.MaxConnections") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.max_connections = utils::string::to_uint8(value);
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return std::to_string(get_remote_config().max_connections);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.ReceiveTimeoutMs") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.recv_timeout_ms = utils::string::to_uint32(value);
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return std::to_string(get_remote_config().recv_timeout_ms);
|
||||||
|
}
|
||||||
|
if (name == "RemoteConfig.SendTimeoutMs") {
|
||||||
|
auto cfg = get_remote_config();
|
||||||
|
cfg.send_timeout_ms = utils::string::to_uint32(value);
|
||||||
|
set_remote_config(cfg);
|
||||||
|
return std::to_string(get_remote_config().send_timeout_ms);
|
||||||
|
}
|
||||||
if (name == "RemoteMount.ApiPort") {
|
if (name == "RemoteMount.ApiPort") {
|
||||||
set_remote_api_port(utils::string::to_uint16(value));
|
set_remote_api_port(utils::string::to_uint16(value));
|
||||||
return std::to_string(get_remote_api_port());
|
return std::to_string(get_remote_api_port());
|
||||||
|
@ -329,9 +329,9 @@ auto encrypt_provider::get_file_list(api_file_list &list,
|
|||||||
-> api_error {
|
-> api_error {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
try {
|
const auto &cfg = get_encrypt_config();
|
||||||
const auto &cfg = get_encrypt_config();
|
|
||||||
|
|
||||||
|
try {
|
||||||
for (const auto &dir_entry : utils::file::directory{cfg.path}.get_items()) {
|
for (const auto &dir_entry : utils::file::directory{cfg.path}.get_items()) {
|
||||||
std::string api_path{};
|
std::string api_path{};
|
||||||
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
|
if (process_directory_entry(*dir_entry.get(), cfg, api_path)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user