diff options
author | almalh <almalh@proton.me> | 2023-03-05 19:58:46 -0500 |
---|---|---|
committer | almalh <almalh@proton.me> | 2023-03-05 20:32:40 -0500 |
commit | b13ddb9a16d8e7001749ac6cc9a24123cdc40e06 (patch) | |
tree | 15e545d0d18ffb6831e9691b3da88b100d5ab7d6 | |
parent | Merge pull request #8737 (diff) | |
download | monero-b13ddb9a16d8e7001749ac6cc9a24123cdc40e06.tar.xz |
Handle case where a command line flag is not allowed in the config file
-rw-r--r-- | src/daemon/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 3d90e0855..38b99ff49 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -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 |