This commit is contained in:
Scott E. Graves 2024-12-20 14:00:08 -06:00
parent 4fd1e7507a
commit 74f9364196

View File

@ -872,7 +872,7 @@ auto app_config::get_value(const json &data, const std::string &name, dest &dst,
try {
if (data.find(name) == data.end()) {
found = false;
return ret;
return false;
}
data.at(name).get_to(dst);
@ -938,70 +938,46 @@ auto app_config::load() -> bool {
get_value(json_document, JSON_BACKGROUND_DOWNLOAD_TIMEOUT_SECS,
download_timeout_secs_, found);
get_value(json_document, JSON_DATABASE_TYPE, db_type_, found);
get_value(json_document, JSON_EVICTION_DELAY_MINS, eviction_delay_mins_,
found);
get_value(json_document, JSON_EVICTION_USE_ACCESS_TIME,
eviction_uses_accessed_time_, found);
get_value(json_document, JSON_ENABLE_CHUNK_DOWNLOADER_TIMEOUT,
enable_chunk_downloader_timeout_, found);
get_value(json_document, JSON_ENABLE_COMM_DURATION_EVENTS,
enable_comm_duration_events_, found);
get_value(json_document, JSON_ENABLE_DRIVE_EVENTS, enable_drive_events_,
found);
if (json_document.find(JSON_ENCRYPT_CONFIG) != json_document.end()) {
json_document.at(JSON_ENCRYPT_CONFIG)
.get_to<atomic<encrypt_config>>(encrypt_config_);
} else {
found = false;
}
get_value(json_document, JSON_EVENT_LEVEL, event_level_, found);
if (json_document.find(JSON_HOST_CONFIG) != json_document.end()) {
json_document.at(JSON_HOST_CONFIG)
.get_to<atomic<host_config>>(host_config_);
} else {
found = false;
}
if (json_document.find(JSON_S3_CONFIG) != json_document.end()) {
json_document.at(JSON_S3_CONFIG).get_to<atomic<s3_config>>(s3_config_);
} else {
found = false;
}
if (json_document.find(JSON_SIA_CONFIG) != json_document.end()) {
json_document.at(JSON_SIA_CONFIG).get_to<atomic<sia_config>>(sia_config_);
} else {
found = false;
}
get_value(json_document, JSON_RING_BUFFER_FILE_SIZE, ring_buffer_file_size_,
found);
get_value(json_document, JSON_TASK_WAIT_MS, task_wait_ms_, found);
#if defined(_WIN32)
get_value(json_document, JSON_ENABLE_MOUNT_MANAGER, enable_mount_manager_,
found);
#endif // defined(_WIN32)
get_value(json_document, JSON_ENCRYPT_CONFIG, encrypt_config_, found);
get_value(json_document, JSON_EVENT_LEVEL, event_level_, found);
get_value(json_document, JSON_EVICTION_DELAY_MINS, eviction_delay_mins_,
found);
get_value(json_document, JSON_EVICTION_USE_ACCESS_TIME,
eviction_uses_accessed_time_, found);
get_value(json_document, JSON_HIGH_FREQ_INTERVAL_SECS,
high_freq_interval_secs_, found);
get_value(json_document, JSON_HOST_CONFIG, host_config_, found);
get_value(json_document, JSON_LOW_FREQ_INTERVAL_SECS,
low_freq_interval_secs_, found);
get_value(json_document, JSON_MAX_CACHE_SIZE_BYTES, max_cache_size_bytes_,
found);
get_value(json_document, JSON_MAX_UPLOAD_COUNT, max_upload_count_, found);
get_value(json_document, JSON_ONLINE_CHECK_RETRY_SECS,
online_check_retry_secs_, found);
get_value(json_document, JSON_HIGH_FREQ_INTERVAL_SECS,
high_freq_interval_secs_, found);
get_value(json_document, JSON_LOW_FREQ_INTERVAL_SECS,
low_freq_interval_secs_, found);
get_value(json_document, JSON_MED_FREQ_INTERVAL_SECS,
med_freq_interval_secs_, found);
get_value(json_document, JSON_ONLINE_CHECK_RETRY_SECS,
online_check_retry_secs_, found);
get_value(json_document, JSON_ORPHANED_FILE_RETENTION_DAYS,
orphaned_file_retention_days_, found);
get_value(json_document, JSON_PREFERRED_DOWNLOAD_TYPE,
preferred_download_type_, found);
get_value(json_document, JSON_RETRY_READ_COUNT, retry_read_count_, found);
get_value(json_document, JSON_REMOTE_CONFIG, remote_config_, found);
get_value(json_document, JSON_REMOTE_MOUNT, remote_mount_, found);
get_value(json_document, JSON_RETRY_READ_COUNT, retry_read_count_, found);
get_value(json_document, JSON_RING_BUFFER_FILE_SIZE, ring_buffer_file_size_,
found);
get_value(json_document, JSON_S3_CONFIG, s3_config_, found);
get_value(json_document, JSON_SIA_CONFIG, sia_config_, found);
get_value(json_document, JSON_TASK_WAIT_MS, task_wait_ms_, found);
std::uint64_t version{};
get_value(json_document, JSON_VERSION, version, found);
@ -1025,6 +1001,7 @@ auto app_config::load() -> bool {
config_file_path));
}
config_changed_ = true;
return false;
}