diff options
Diffstat (limited to 'src/mongo/db/server_options_helpers.cpp')
-rw-r--r-- | src/mongo/db/server_options_helpers.cpp | 220 |
1 files changed, 112 insertions, 108 deletions
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp index 9ab8e97c86c..c1729324606 100644 --- a/src/mongo/db/server_options_helpers.cpp +++ b/src/mongo/db/server_options_helpers.cpp @@ -36,10 +36,10 @@ #define SYSLOG_NAMES #include <syslog.h> #endif -#include <ios> -#include <iostream> #include <boost/filesystem.hpp> #include <boost/filesystem/operations.hpp> +#include <ios> +#include <iostream> #include "mongo/base/status.h" #include "mongo/bson/util/builder.h" @@ -82,26 +82,13 @@ typedef struct _code { int c_val; } CODE; -CODE facilitynames[] = {{"auth", LOG_AUTH}, - {"cron", LOG_CRON}, - {"daemon", LOG_DAEMON}, - {"kern", LOG_KERN}, - {"lpr", LOG_LPR}, - {"mail", LOG_MAIL}, - {"news", LOG_NEWS}, - {"security", LOG_AUTH}, /* DEPRECATED */ - {"syslog", LOG_SYSLOG}, - {"user", LOG_USER}, - {"uucp", LOG_UUCP}, - {"local0", LOG_LOCAL0}, - {"local1", LOG_LOCAL1}, - {"local2", LOG_LOCAL2}, - {"local3", LOG_LOCAL3}, - {"local4", LOG_LOCAL4}, - {"local5", LOG_LOCAL5}, - {"local6", LOG_LOCAL6}, - {"local7", LOG_LOCAL7}, - {NULL, -1}}; +CODE facilitynames[] = {{"auth", LOG_AUTH}, {"cron", LOG_CRON}, {"daemon", LOG_DAEMON}, + {"kern", LOG_KERN}, {"lpr", LOG_LPR}, {"mail", LOG_MAIL}, + {"news", LOG_NEWS}, {"security", LOG_AUTH}, /* DEPRECATED */ + {"syslog", LOG_SYSLOG}, {"user", LOG_USER}, {"uucp", LOG_UUCP}, + {"local0", LOG_LOCAL0}, {"local1", LOG_LOCAL1}, {"local2", LOG_LOCAL2}, + {"local3", LOG_LOCAL3}, {"local4", LOG_LOCAL4}, {"local5", LOG_LOCAL5}, + {"local6", LOG_LOCAL6}, {"local7", LOG_LOCAL7}, {NULL, -1}}; #endif // !defined(INTERNAL_NOPRI) #endif // defined(SYSLOG_NAMES) @@ -127,10 +114,9 @@ Status addGeneralServerOptions(moe::OptionSection* options) { options->addOptionChaining("version", "version", moe::Switch, "show version information") .setSources(moe::SourceAllLegacy); - options->addOptionChaining("config", - "config,f", - moe::String, - "configuration file specifying additional options") + options + ->addOptionChaining( + "config", "config,f", moe::String, "configuration file specifying additional options") .setSources(moe::SourceAllLegacy); // The verbosity level can be set at startup in the following ways. Note that if multiple @@ -166,11 +152,12 @@ Status addGeneralServerOptions(moe::OptionSection* options) { // component: | // Sharding: | // verbosity: 5 | 5 (for Sharding only, 0 for default) - options->addOptionChaining( - "verbose", - "verbose,v", - moe::String, - "be more verbose (include multiple times for more verbosity e.g. -vvvvv)") + options + ->addOptionChaining( + "verbose", + "verbose,v", + moe::String, + "be more verbose (include multiple times for more verbosity e.g. -vvvvv)") .setImplicit(moe::Value(std::string("v"))) .setSources(moe::SourceAllLegacy); @@ -183,11 +170,11 @@ Status addGeneralServerOptions(moe::OptionSection* options) { if (component == logger::LogComponent::kDefault) { continue; } - options->addOptionChaining("systemLog.component." + component.getDottedName() + - ".verbosity", - "", - moe::Int, - "set component verbose level for " + component.getDottedName()) + options + ->addOptionChaining("systemLog.component." + component.getDottedName() + ".verbosity", + "", + moe::Int, + "set component verbose level for " + component.getDottedName()) .setSources(moe::SourceYAMLConfig); } @@ -207,36 +194,39 @@ Status addGeneralServerOptions(moe::OptionSection* options) { options->addOptionChaining( "net.maxIncomingConnections", "maxConns", moe::Int, maxConnInfoBuilder.str().c_str()); - options->addOptionChaining( - "logpath", - "logpath", - moe::String, - "log file to send write to instead of stdout - has to be a file, not directory") + options + ->addOptionChaining( + "logpath", + "logpath", + moe::String, + "log file to send write to instead of stdout - has to be a file, not directory") .setSources(moe::SourceAllLegacy) .incompatibleWith("syslog"); options ->addOptionChaining( - "systemLog.path", - "", - moe::String, - "log file to send writes to if logging to a file - has to be a file, not directory") + "systemLog.path", + "", + moe::String, + "log file to send writes to if logging to a file - has to be a file, not directory") .setSources(moe::SourceYAMLConfig) .hidden(); - options->addOptionChaining("systemLog.destination", - "", - moe::String, - "Destination of system log output. (syslog/file)") + options + ->addOptionChaining("systemLog.destination", + "", + moe::String, + "Destination of system log output. (syslog/file)") .setSources(moe::SourceYAMLConfig) .hidden() .format("(:?syslog)|(:?file)", "(syslog/file)"); #ifndef _WIN32 - options->addOptionChaining("syslog", - "syslog", - moe::Switch, - "log to system's syslog facility instead of file or stdout") + options + ->addOptionChaining("syslog", + "syslog", + moe::Switch, + "log to system's syslog facility instead of file or stdout") .incompatibleWith("logpath") .setSources(moe::SourceAllLegacy); @@ -267,10 +257,10 @@ Status addGeneralServerOptions(moe::OptionSection* options) { moe::String, "full path to pidfile (if not set, no pidfile is created)"); - options->addOptionChaining("security.keyFile", - "keyFile", - moe::String, - "private key for cluster authentication").incompatibleWith("noauth"); + options + ->addOptionChaining( + "security.keyFile", "keyFile", moe::String, "private key for cluster authentication") + .incompatibleWith("noauth"); options->addOptionChaining("noauth", "noauth", moe::Switch, "run without security") .setSources(moe::SourceAllLegacy) @@ -279,46 +269,52 @@ Status addGeneralServerOptions(moe::OptionSection* options) { .incompatibleWith("transitionToAuth") .incompatibleWith("clusterAuthMode"); - options->addOptionChaining( - "setParameter", "setParameter", moe::StringMap, "Set a configurable parameter") + options + ->addOptionChaining( + "setParameter", "setParameter", moe::StringMap, "Set a configurable parameter") .composing(); - options->addOptionChaining( - "httpinterface", "httpinterface", moe::Switch, "enable http interface") + options + ->addOptionChaining("httpinterface", "httpinterface", moe::Switch, "enable http interface") .setSources(moe::SourceAllLegacy) .incompatibleWith("nohttpinterface"); options->addOptionChaining("net.http.enabled", "", moe::Bool, "enable http interface") .setSources(moe::SourceYAMLConfig); - options->addOptionChaining( - "net.http.port", "", moe::Switch, "port to listen on for http interface") + options + ->addOptionChaining( + "net.http.port", "", moe::Switch, "port to listen on for http interface") .setSources(moe::SourceYAMLConfig); - options->addOptionChaining( - "security.transitionToAuth", - "transitionToAuth", - moe::Switch, - "For rolling access control upgrade. Attempt to authenticate over outgoing " - "connections and proceed regardless of success. Accept incoming connections " - "with or without authentication.").incompatibleWith("noauth"); + options + ->addOptionChaining( + "security.transitionToAuth", + "transitionToAuth", + moe::Switch, + "For rolling access control upgrade. Attempt to authenticate over outgoing " + "connections and proceed regardless of success. Accept incoming connections " + "with or without authentication.") + .incompatibleWith("noauth"); - options->addOptionChaining( - "security.clusterAuthMode", - "clusterAuthMode", - moe::String, - "Authentication mode used for cluster authentication. Alternatives are " - "(keyFile|sendKeyFile|sendX509|x509)") + options + ->addOptionChaining("security.clusterAuthMode", + "clusterAuthMode", + moe::String, + "Authentication mode used for cluster authentication. Alternatives are " + "(keyFile|sendKeyFile|sendX509|x509)") .format("(:?keyFile)|(:?sendKeyFile)|(:?sendX509)|(:?x509)", "(keyFile/sendKeyFile/sendX509/x509)"); #ifndef _WIN32 - options->addOptionChaining( - "nounixsocket", "nounixsocket", moe::Switch, "disable listening on unix sockets") + options + ->addOptionChaining( + "nounixsocket", "nounixsocket", moe::Switch, "disable listening on unix sockets") .setSources(moe::SourceAllLegacy); - options->addOptionChaining( - "net.unixDomainSocket.enabled", "", moe::Bool, "disable listening on unix sockets") + options + ->addOptionChaining( + "net.unixDomainSocket.enabled", "", moe::Bool, "disable listening on unix sockets") .setSources(moe::SourceYAMLConfig); options->addOptionChaining("net.unixDomainSocket.pathPrefix", @@ -344,45 +340,52 @@ Status addGeneralServerOptions(moe::OptionSection* options) { } // Extra hidden options - options->addOptionChaining( - "nohttpinterface", "nohttpinterface", moe::Switch, "disable http interface") + options + ->addOptionChaining( + "nohttpinterface", "nohttpinterface", moe::Switch, "disable http interface") .hidden() .setSources(moe::SourceAllLegacy) .incompatibleWith("httpinterface"); - options->addOptionChaining("objcheck", - "objcheck", - moe::Switch, - "inspect client data for validity on receipt (DEFAULT)") + options + ->addOptionChaining("objcheck", + "objcheck", + moe::Switch, + "inspect client data for validity on receipt (DEFAULT)") .hidden() .setSources(moe::SourceAllLegacy) .incompatibleWith("noobjcheck"); - options->addOptionChaining("noobjcheck", - "noobjcheck", - moe::Switch, - "do NOT inspect client data for validity on receipt") + options + ->addOptionChaining("noobjcheck", + "noobjcheck", + moe::Switch, + "do NOT inspect client data for validity on receipt") .hidden() .setSources(moe::SourceAllLegacy) .incompatibleWith("objcheck"); - options->addOptionChaining("net.wireObjectCheck", - "", - moe::Bool, - "inspect client data for validity on receipt (DEFAULT)") + options + ->addOptionChaining("net.wireObjectCheck", + "", + moe::Bool, + "inspect client data for validity on receipt (DEFAULT)") .hidden() .setSources(moe::SourceYAMLConfig); - options->addOptionChaining("systemLog.traceAllExceptions", - "traceExceptions", - moe::Switch, - "log stack traces for every exception").hidden(); + options + ->addOptionChaining("systemLog.traceAllExceptions", + "traceExceptions", + moe::Switch, + "log stack traces for every exception") + .hidden(); - options->addOptionChaining("enableExperimentalStorageDetailsCmd", - "enableExperimentalStorageDetailsCmd", - moe::Switch, - "EXPERIMENTAL (UNSUPPORTED). " - "Enable command computing aggregate statistics on storage.") + options + ->addOptionChaining("enableExperimentalStorageDetailsCmd", + "enableExperimentalStorageDetailsCmd", + moe::Switch, + "EXPERIMENTAL (UNSUPPORTED). " + "Enable command computing aggregate statistics on storage.") .hidden() .setSources(moe::SourceAllLegacy); @@ -396,11 +399,12 @@ Status addWindowsServerOptions(moe::OptionSection* options) { options->addOptionChaining("remove", "remove", moe::Switch, "remove Windows service") .setSources(moe::SourceAllLegacy); - options->addOptionChaining( - "reinstall", - "reinstall", - moe::Switch, - "reinstall Windows service (equivalent to --remove followed by --install)") + options + ->addOptionChaining( + "reinstall", + "reinstall", + moe::Switch, + "reinstall Windows service (equivalent to --remove followed by --install)") .setSources(moe::SourceAllLegacy); options->addOptionChaining("processManagement.windowsService.serviceName", |