Skip to content

Commit

Permalink
Merge pull request #8766
Browse files Browse the repository at this point in the history
ad80f1b Handle case where a command line flag is not allowed in the config file (almalh)
  • Loading branch information
luigi1111 committed Apr 25, 2023
2 parents e06129b + ad80f1b commit 2f45d5c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,19 @@ int main(int argc, char const * argv[])
{
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
}
catch (const po::unknown_option &e)
{
std::string unrecognized_option = e.get_option_name();
if (all_options.find_nothrow(unrecognized_option, false))
{
std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl;
}
else
{
std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl;
}
return 1;
}
catch (const std::exception &e)
{
// log system isn't initialized yet
Expand Down

0 comments on commit 2f45d5c

Please sign in to comment.