Fixes to Context::Configure with default config

pull/1312/head
Stephen Shelton 4 years ago
parent ced2ac64fb
commit f607b99dbe
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -38,7 +38,17 @@ namespace llarp
fs::path defaultDataDir = dataDir ? *dataDir : GetDefaultDataDir();
if (not configfile.empty())
// TODO: DRY / refactor to use exceptions
if (configfile.empty())
{
if (not config->LoadDefault(opts.isRouter, defaultDataDir))
{
config.release();
llarp::LogError("failed to load default config");
return false;
}
}
else
{
if (!config->Load(configfile.c_str(), opts.isRouter, defaultDataDir))
{

@ -243,10 +243,12 @@ namespace llarp
// we need this first so we can start lmq to fetch keys
if (conf)
{
whitelistRouters = conf->lokid.whitelistRouters;
if (whitelistRouters)
lokidRPCAddr = lokimq::address(conf->lokid.lokidRPCAddr);
enableRPCServer = conf->api.m_enableRPCServer;
rpcBindAddr = lokimq::address(conf->api.m_rpcBindAddr);
whitelistRouters = conf->lokid.whitelistRouters;
lokidRPCAddr = lokimq::address(conf->lokid.lokidRPCAddr);
}
if (not StartRpcServer())
throw std::runtime_error("Failed to start rpc server");

@ -12,7 +12,7 @@ std::shared_ptr<llarp::Context>
make_context()
{
auto context = std::make_shared<llarp::Context>();
context->Configure(opts, {}, {});
REQUIRE(context->Configure(opts, {}, {}) == true);
REQUIRE(context->config != nullptr);
REQUIRE(context->config->LoadDefault(true, fs::current_path()));

@ -12,7 +12,8 @@ static std::shared_ptr<llarp::Context>
make_context(std::optional<fs::path> keyfile)
{
auto context = std::make_shared<llarp::Context>();
context->Configure(opts, {}, {});
REQUIRE(context->Configure(opts, {}, {}) == true);
REQUIRE(context->config != nullptr);
context->config->network.m_endpointType = "null";
context->config->network.m_keyfile = keyfile;

Loading…
Cancel
Save