2018-12-15 16:21:52 +00:00
|
|
|
#include <service/config.hpp>
|
2019-01-11 00:12:43 +00:00
|
|
|
|
2019-01-11 01:19:36 +00:00
|
|
|
#include <util/ini.hpp>
|
2019-01-11 00:12:43 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
|
|
|
bool
|
|
|
|
Config::Load(const std::string& fname)
|
|
|
|
{
|
2019-01-22 14:13:26 +00:00
|
|
|
llarp::ConfigParser parser;
|
|
|
|
if(!parser.LoadFile(fname.c_str()))
|
|
|
|
return false;
|
|
|
|
parser.IterAll([&](const llarp::ConfigParser::String_t& name,
|
|
|
|
const llarp::ConfigParser::Section_t& section) {
|
|
|
|
llarp::service::Config::section_t values;
|
|
|
|
values.first = name;
|
|
|
|
for(const auto& item : section)
|
|
|
|
values.second.emplace_back(item.first, item.second);
|
|
|
|
services.emplace_back(values);
|
|
|
|
});
|
2019-01-11 00:12:43 +00:00
|
|
|
return services.size() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|