1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Inject a default bootstrap file if none in conf

This commit is contained in:
Stephen Shelton 2020-04-02 09:13:39 -06:00
parent da6bda15a1
commit 91206725cb
No known key found for this signature in database
GPG key ID: EE4BADACCE8B631C

View file

@ -454,6 +454,24 @@ namespace llarp
std::vector<fs::path> configRouters = conf->connect.routers;
configRouters.insert(configRouters.end(), conf->bootstrap.routers.begin(),
conf->bootstrap.routers.end());
// if our conf had no bootstrap files specified, try the default location of
// <DATA_DIR>/bootstrap.signed. If this isn't present, leave a useful error message
if (configRouters.size() == 0)
{
// TODO: use constant
fs::path defaultBootstrapFile = conf->router.m_dataDir / "bootstrap.signed";
if (fs::exists(defaultBootstrapFile))
configRouters.push_back(defaultBootstrapFile);
else
{
LogError("No bootstrap files specified in config file, and the default");
LogError("bootstrap file ", defaultBootstrapFile, " does not exist.");
LogError("Please provide a bootstrap file (e.g. run 'lokinet-bootstrap'");
throw std::runtime_error("No bootstrap files available.");
}
}
BootstrapList b_list;
for (const auto& router : configRouters)
{