refactor app config
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
Scott E. Graves 2024-12-20 15:23:03 -06:00
parent f14b1c7168
commit d2a8aef843
2 changed files with 22 additions and 22 deletions

View File

@ -106,28 +106,6 @@ private:
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
private:
template <typename dest>
auto get_value(const json &data, const std::string &name, dest &dst,
bool &found) -> bool {
REPERTORY_USES_FUNCTION_NAME();
try {
if (data.find(name) == data.end()) {
found = false;
return false;
}
data.at(name).get_to(dst);
return true;
} catch (const std::exception &ex) {
utils::error::raise_error(
function_name, ex, fmt::format("failed to get value|name|{}", name));
}
found = false;
return false;
}
[[nodiscard]] auto load() -> bool;
template <typename dest, typename source>

View File

@ -53,6 +53,28 @@ constexpr const auto default_retry_read_count{6U};
constexpr const auto default_ring_buffer_file_size{512U};
constexpr const auto default_task_wait_ms{100U};
constexpr const auto min_cache_size_bytes{100ULL * 1024ULL * 1024ULL};
template <typename dest>
auto get_value(const json &data, const std::string &name, dest &dst,
bool &found) -> bool {
REPERTORY_USES_FUNCTION_NAME();
try {
if (data.find(name) == data.end()) {
found = false;
return false;
}
data.at(name).get_to(dst);
return true;
} catch (const std::exception &ex) {
repertory::utils::error::raise_error(
function_name, ex, fmt::format("failed to get value|name|{}", name));
}
found = false;
return false;
}
} // namespace
namespace repertory {