mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-04 11:55:51 +00:00
fix: comment from verify config PR (#1823)
PR here: https://github.com/XRPLF/clio/pull/1814#
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user