2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/getMultipleKeysFromConfig.h>
|
2017-03-21 19:08:09 +00:00
|
|
|
|
|
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
2018-01-15 19:07:47 +00:00
|
|
|
#include <Common/StringUtils/StringUtils.h>
|
2017-03-21 19:08:09 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2017-08-07 13:36:03 +00:00
|
|
|
std::vector<std::string> getMultipleKeysFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
2017-03-21 19:08:09 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
std::vector<std::string> values;
|
|
|
|
Poco::Util::AbstractConfiguration::Keys config_keys;
|
|
|
|
config.keys(root, config_keys);
|
|
|
|
for (const auto & key : config_keys)
|
|
|
|
{
|
2020-03-08 21:18:53 +00:00
|
|
|
if (key != name && !(startsWith(key, name + "[") && endsWith(key, "]")))
|
2017-04-01 07:20:54 +00:00
|
|
|
continue;
|
|
|
|
values.emplace_back(key);
|
|
|
|
}
|
|
|
|
return values;
|
2017-03-21 19:08:09 +00:00
|
|
|
}
|
2017-06-22 18:56:40 +00:00
|
|
|
|
|
|
|
|
2017-08-07 13:36:03 +00:00
|
|
|
std::vector<std::string> getMultipleValuesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & root, const std::string & name)
|
2017-06-22 18:56:40 +00:00
|
|
|
{
|
|
|
|
std::vector<std::string> values;
|
|
|
|
for (const auto & key : DB::getMultipleKeysFromConfig(config, root, name))
|
2019-10-17 16:52:47 +00:00
|
|
|
values.emplace_back(config.getString(root.empty() ? key : root + "." + key));
|
2017-06-22 18:56:40 +00:00
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
2017-03-21 19:08:09 +00:00
|
|
|
}
|