mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
24 lines
519 B
C++
24 lines
519 B
C++
#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);
|
|
if (sub_keys.empty() && config.getString(key).empty())
|
|
return empty_as;
|
|
return config.getBool(key, default_);
|
|
}
|
|
|
|
}
|
|
|
|
}
|