Fall back to using SysconfDir + "/icinga2/icinga2.conf" if --config is not specified

fixes #6874
This commit is contained in:
Gunnar Beutner 2014-08-17 13:48:55 +02:00
parent 3da5568eb3
commit 25ed7dcdb2
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -90,7 +90,8 @@ static bool LoadConfigFiles(const String& appType, const String& objectsFile = S
BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<std::string> >()) {
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) {