mirror of https://github.com/Icinga/icinga2.git
Fall back to using SysconfDir + "/icinga2/icinga2.conf" if --config is not specified
fixes #6874
This commit is contained in:
parent
3da5568eb3
commit
25ed7dcdb2
|
@ -1022,6 +1022,10 @@ added.
|
||||||
Using the `--config` option you can specify one or more configuration files.
|
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.
|
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
|
#### Config Validation
|
||||||
|
|
||||||
The `--validate` option can be used to check if your configuration files
|
The `--validate` option can be used to check if your configuration files
|
||||||
|
|
|
@ -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> >()) {
|
BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<std::string> >()) {
|
||||||
ConfigCompiler::CompileFile(configPath);
|
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
|
/* Load cluster config files - this should probably be in libremote but
|
||||||
* unfortunately moving it there is somewhat non-trivial. */
|
* 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")) {
|
if (!g_AppParams.count("validate") && !g_AppParams.count("reload-internal")) {
|
||||||
pid_t runningpid = Application::ReadPidFile(Application::GetPidPath());
|
pid_t runningpid = Application::ReadPidFile(Application::GetPidPath());
|
||||||
if (runningpid > 0) {
|
if (runningpid > 0) {
|
||||||
|
|
Loading…
Reference in New Issue