diff --git a/CHANGELOG b/CHANGELOG index e68284ccfa..08a9fadc43 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -100,6 +100,12 @@ v1.5.x (XXXX-XX-XX) currently only implemented for hash indices and skiplist indices. +v1.4.5 (XXXX-XX-XX) +------------------- + +* added override file "arangod.conf.local" (and co) + + v1.4.4 (2013-12-24) ------------------- diff --git a/arangosh/ArangoShell/ArangoClient.cpp b/arangosh/ArangoShell/ArangoClient.cpp index 9970da9d62..e807e0a5e9 100644 --- a/arangosh/ArangoShell/ArangoClient.cpp +++ b/arangosh/ArangoShell/ArangoClient.cpp @@ -279,6 +279,7 @@ void ArangoClient::parse (ProgramOptions& options, // parse config file string configFile = ""; + bool allowLocal = false; if (! _configFile.empty()) { if (StringUtils::tolower(_configFile) == string("none")) { @@ -299,6 +300,7 @@ void ArangoClient::parse (ProgramOptions& options, if (FileUtils::exists(sysDir)) { configFile = sysDir; + allowLocal = true; } else { LOG_DEBUG("no system init file '%s'", sysDir.c_str()); @@ -307,6 +309,18 @@ void ArangoClient::parse (ProgramOptions& options, } if (! configFile.empty()) { + if (allowLocal) { + string localConfigFile = configFile + ".local"; + + if (FileUtils::exists(localConfigFile)) { + LOG_DEBUG("using init override file '%s'", localConfigFile.c_str()); + + if (! options.parse(description, localConfigFile)) { + LOG_FATAL_AND_EXIT("cannot parse config file '%s': %s", localConfigFile.c_str(), options.lastError().c_str()); + } + } + } + LOG_DEBUG("using init file '%s'", configFile.c_str()); if (! options.parse(description, configFile)) { diff --git a/lib/ApplicationServer/ApplicationServer.cpp b/lib/ApplicationServer/ApplicationServer.cpp index b8f10e714d..d1aba9c376 100644 --- a/lib/ApplicationServer/ApplicationServer.cpp +++ b/lib/ApplicationServer/ApplicationServer.cpp @@ -1002,8 +1002,27 @@ bool ApplicationServer::readConfigurationFile () { if (d != 0) { string sysDir = string(d) + _systemConfigFile; + string localSysDir = sysDir + ".local"; + TRI_FreeString(TRI_CORE_MEM_ZONE, d); + // check and see if a local override file exists + if (FileUtils::exists(localSysDir)) { + LOG_INFO("using init override file '%s'", localSysDir.c_str()); + + bool ok = _options.parse(_descriptionFile, localSysDir); + + // Observe that this is treated as an error - the configuration file exists + // but for some reason can not be parsed. Best to report an error. + if (! ok) { + LOG_ERROR("cannot parse config file '%s': %s", localSysDir.c_str(), _options.lastError().c_str()); + return ok; + } + } + else { + LOG_TRACE("no system init override file '%s' found", sysDir.c_str()); + } + // check and see if file exists if (FileUtils::exists(sysDir)) { LOG_INFO("using init file '%s'", sysDir.c_str()); @@ -1012,7 +1031,6 @@ bool ApplicationServer::readConfigurationFile () { // Observe that this is treated as an error - the configuration file exists // but for some reason can not be parsed. Best to report an error. - if (! ok) { LOG_ERROR("cannot parse config file '%s': %s", sysDir.c_str(), _options.lastError().c_str()); } diff --git a/lib/ApplicationServer/ApplicationServer.h b/lib/ApplicationServer/ApplicationServer.h index e5767d5b0f..5e745a54e4 100644 --- a/lib/ApplicationServer/ApplicationServer.h +++ b/lib/ApplicationServer/ApplicationServer.h @@ -422,14 +422,18 @@ namespace triagens { /// Specifies the name of the configuration file to use. /// /// If this command is not passed to the server, then by default, the server -/// will attempt to first locate a file named @LIT{~/.arango/arangod.conf} in the +/// will attempt to first locate a file named `~/.arango/arangod.conf` in the /// user's home directory. /// /// If no such file is found, the server will proceed to look for a file -/// @LIT{arangod.conf} in the system configuration directory. The system +/// `arangod.conf` in the system configuration directory. The system /// configuration directory is platform-specific, and may be changed when -/// compiling ArangoDB yourself. It may default to @LIT{/etc} or -/// @LIT{/usr/local/etc}. +/// compiling ArangoDB yourself. It may default to `/etc/arangodb` or +/// `/usr/local/etc/arangodb`. This file is installed when using a package +/// manager like rpm or dpkg. If you modify this file and later upgrade to a new +/// version of ArangoDB, then the package manager normally warns you about the +/// conflict. In order to avoid these warning for small adjustments, you can put +/// local overrides into a file `arangod.conf.local`. /// /// Only command line options with a value should be set within the /// configuration file. Command line options which act as flags should be