From ca24f256653e9333b421d79dde47f3c4fa19cd89 Mon Sep 17 00:00:00 2001 From: Stephen Shelton Date: Tue, 7 Apr 2020 17:52:14 -0600 Subject: [PATCH] Make fewer assumptions about config state This handles values missing when config is created through RouterHive. --- llarp/router/router.cpp | 2 +- llarp/util/logging/logger.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index 9e7cc22d8..300d2d09a 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -457,7 +457,7 @@ namespace llarp // if our conf had no bootstrap files specified, try the default location of // /bootstrap.signed. If this isn't present, leave a useful error message - if (configRouters.size() == 0) + if (configRouters.size() == 0 and not m_isServiceNode) { // TODO: use constant fs::path defaultBootstrapFile = conf->router.m_dataDir / "bootstrap.signed"; diff --git a/llarp/util/logging/logger.cpp b/llarp/util/logging/logger.cpp index f516ef6a5..42c8b8366 100644 --- a/llarp/util/logging/logger.cpp +++ b/llarp/util/logging/logger.cpp @@ -108,7 +108,7 @@ namespace llarp nodeName = nickname; FILE* logfile = nullptr; - if (file == "stdout") + if (file == "stdout" or file.empty()) { logfile = stdout; } @@ -125,7 +125,7 @@ namespace llarp switch (type) { case LogType::Unknown: - throw std::invalid_argument("Cannot use LogType::Unknown"); + // tolerate as fallback to LogType::File case LogType::File: if (logfile != stdout)