diff --git a/src/app/VerifyConfig.hpp b/src/app/VerifyConfig.hpp index 63c806dc9..6a540ed7b 100644 --- a/src/app/VerifyConfig.hpp +++ b/src/app/VerifyConfig.hpp @@ -41,13 +41,15 @@ verifyConfig(std::string_view configPath) auto const json = ConfigFileJson::makeConfigFileJson(configPath); if (!json.has_value()) { - std::cerr << json.error().error << std::endl; + std::cerr << "Error parsing json from config: " << configPath << "\n" << json.error().error << std::endl; return false; } auto const errors = gClioConfig.parse(json.value()); if (errors.has_value()) { - for (auto const& err : errors.value()) + for (auto const& err : errors.value()) { + std::cerr << "Issues found in provided config '" << configPath << "':\n"; std::cerr << err.error << std::endl; + } return false; } return true; diff --git a/src/main/Main.cpp b/src/main/Main.cpp index bd060b12d..b2ce539a6 100644 --- a/src/main/Main.cpp +++ b/src/main/Main.cpp @@ -42,7 +42,7 @@ try { [](app::CliArgs::Action::Exit const& exit) { return exit.exitCode; }, [](app::CliArgs::Action::VerifyConfig const& verify) { if (app::verifyConfig(verify.configPath)) { - std::cout << "Config is correct" << "\n"; + std::cout << "Config " << verify.configPath << " is correct" << "\n"; return EXIT_SUCCESS; } return EXIT_FAILURE; diff --git a/tests/common/util/newconfig/FakeConfigData.hpp b/tests/common/util/newconfig/FakeConfigData.hpp index f7340276c..4167e2b2e 100644 --- a/tests/common/util/newconfig/FakeConfigData.hpp +++ b/tests/common/util/newconfig/FakeConfigData.hpp @@ -208,11 +208,3 @@ static constexpr auto kINVALID_JSON_DATA = R"JSON({ "withDefault" : "0.0" } })JSON"; - -// used to Verify Config test -static constexpr auto kVALID_JSON_DATA = R"JSON({ - "server": { - "ip": "0.0.0.0", - "port": 51233 - } -})JSON"; diff --git a/tests/unit/app/VerifyConfigTests.cpp b/tests/unit/app/VerifyConfigTests.cpp index 9dad96286..b9d00c94f 100644 --- a/tests/unit/app/VerifyConfigTests.cpp +++ b/tests/unit/app/VerifyConfigTests.cpp @@ -36,6 +36,13 @@ TEST(VerifyConfigTest, InvalidConfig) TEST(VerifyConfigTest, ValidConfig) { + // used to Verify Config test + static constexpr auto kVALID_JSON_DATA = R"JSON({ + "server": { + "ip": "0.0.0.0", + "port": 51233 + } + })JSON"; auto const tmpConfigFile = TmpFile(kVALID_JSON_DATA); // current example config should always be compatible with configDefinition