From 3088b9d39dabec4e8a6820b8af5fecf5c9f5bc7a Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 5 Nov 2013 09:13:43 +0100 Subject: [PATCH] Implement --no-config option. Fixes #4998 --- icinga-app/icinga.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index d59c55d6f..efe55cf24 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -66,8 +66,10 @@ static bool LoadConfigFiles(const String& appType, bool validateOnly) { ConfigCompilerContext::GetInstance()->Reset(); - BOOST_FOREACH(const String& configPath, g_AppParams["config"].as >()) { - ConfigCompiler::CompileFile(configPath); + if (g_AppParams.count("config") > 0) { + BOOST_FOREACH(const String& configPath, g_AppParams["config"].as >()) { + ConfigCompiler::CompileFile(configPath); + } } String name, fragment; @@ -207,6 +209,7 @@ int main(int argc, char **argv) ("include,I", po::value >(), "add include search directory") ("define,D", po::value >(), "define a variable") ("config,c", po::value >(), "parse a configuration file") + ("no-config,z", "start without a configuration file") ("validate,C", "exit after validating the configuration") ("debug,x", "enable debugging") ("daemonize,d", "detach from the controlling terminal") @@ -347,7 +350,7 @@ int main(int argc, char **argv) } } - if (g_AppParams.count("config") == 0) { + if (g_AppParams.count("no-config") == 0 && g_AppParams.count("config") == 0) { Log(LogCritical, "icinga-app", "You need to specify at least one config file (using the --config option)."); return EXIT_FAILURE; -- 2.40.0