diff --git a/doc/2-getting-started.md b/doc/2-getting-started.md index c0162dc0d..a7d908241 100644 --- a/doc/2-getting-started.md +++ b/doc/2-getting-started.md @@ -1022,6 +1022,10 @@ added. Using the `--config` option you can specify one or more configuration files. Config files are processed in the order they're specified on the command-line. +When no configuration file is specified and the `--no-config` is not used +Icinga 2 automatically falls back to using the configuration file +`SysconfDir + "/icinga2/icinga2.conf"` (where SysconfDir is usually `/etc`). + #### Config Validation The `--validate` option can be used to check if your configuration files diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index 7f54d1040..9a9bff17f 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -90,7 +90,8 @@ static bool LoadConfigFiles(const String& appType, const String& objectsFile = S BOOST_FOREACH(const String& configPath, g_AppParams["config"].as >()) { ConfigCompiler::CompileFile(configPath); } - } + } else if (!g_AppParams.count("no-config")) + ConfigCompiler::CompileFile(Application::GetSysconfDir() + "/icinga2/icinga2.conf"); /* Load cluster config files - this should probably be in libremote but * unfortunately moving it there is somewhat non-trivial. */ @@ -530,12 +531,6 @@ int Main(void) } } - 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; - } - if (!g_AppParams.count("validate") && !g_AppParams.count("reload-internal")) { pid_t runningpid = Application::ReadPidFile(Application::GetPidPath()); if (runningpid > 0) {