lokinet/llarp/service/config.cpp
Jason Rhinelander 54186c4a89 Replace absl string_view with string_view from lokimq
When we add loki-mq has a dependency we can just alias it, but for now
it's easier to copy the header than add the whole submodule library.
2020-02-24 14:27:44 -04:00

28 lines
684 B
C++

#include <service/config.hpp>
#include <config/ini.hpp>
namespace llarp
{
namespace service
{
bool
Config::Load(string_view fname)
{
ConfigParser parser;
if(!parser.LoadFile(fname))
return false;
parser.IterAll(
[&](string_view name, const ConfigParser::Section_t& section) {
Config::section_t values;
values.first.assign(name.begin(), name.end());
for(const auto& item : section)
values.second.emplace_back(item.first, item.second);
services.emplace_back(values);
});
return services.size() > 0;
}
} // namespace service
} // namespace llarp