Skip to content

Commit

Permalink
[?] Add function for looking up advanced setting with default.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Nov 9, 2024
1 parent 4aa8237 commit 9c16454
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/core/include/irods/irods_server_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,21 @@ namespace irods
return irods::server_properties::instance().contains(_prop);
}

template <typename T>
T get_advanced_setting_or_default(const std::string_view _prop, const T& _default)
{
auto config_handle = irods::server_properties::instance().map();
const auto& config = config_handle.get_json();

if (const auto adv_iter = config.find("advanced_settings"); adv_iter != std::end(config)) {
if (const auto val_iter = adv_iter->find(_prop); val_iter != std::end(*adv_iter)) {
return val_iter->get<T>();
}
}

return _default;
}

template< typename T >
T get_server_property( const std::string& _prop )
{
Expand Down

0 comments on commit 9c16454

Please sign in to comment.