ClickHouse/src/Common/Config/ConfigHelper.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
519 B
C++
Raw Normal View History

2021-12-30 15:34:11 +00:00
#include <Common/Config/ConfigHelper.h>
#include <Poco/Util/AbstractConfiguration.h>
namespace DB
{
namespace ConfigHelper
{
bool getBool(const Poco::Util::AbstractConfiguration & config, const std::string & key, bool default_, bool empty_as)
{
if (!config.has(key))
return default_;
Poco::Util::AbstractConfiguration::Keys sub_keys;
config.keys(key, sub_keys);
2021-12-31 00:30:21 +00:00
if (sub_keys.empty() && config.getString(key).empty())
2021-12-30 15:34:11 +00:00
return empty_as;
return config.getBool(key, default_);
}
}
}