summaryrefslogtreecommitdiff
path: root/src/mongo/s/mongos_options.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2018-03-16 14:50:47 -0400
committerBen Caimano <ben.caimano@10gen.com>2018-03-22 12:30:03 -0400
commite11d931c36605ea6616b57662b723a51aea01478 (patch)
tree691499489e154764a2c3508a3db35f9480a95a42 /src/mongo/s/mongos_options.cpp
parentd79412fac8372205cb754e9eb1f4f76a5dcb21e2 (diff)
downloadmongo-e11d931c36605ea6616b57662b723a51aea01478.tar.gz
SERVER-33123 Mongos noscripting command line and configuration
Hid --noscripting, added and hid security.javascriptEnabled, warned on set for mongos.
Diffstat (limited to 'src/mongo/s/mongos_options.cpp')
-rw-r--r--src/mongo/s/mongos_options.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp
index 5163ca6c295..fea657c5c02 100644
--- a/src/mongo/s/mongos_options.cpp
+++ b/src/mongo/s/mongos_options.cpp
@@ -98,10 +98,26 @@ Status addMongosOptions(moe::OptionSection* options) {
sharding_options.addOptionChaining("test", "test", moe::Switch, "just run unit tests")
.setSources(moe::SourceAllLegacy);
+ /** Javascript Options
+ * As a general rule, js enable/disable options are ignored for mongos.
+ * However, we define and hide these options so that if someone
+ * were to use these args in a set of options meant for both
+ * mongos and mongod runs, the mongos won't fail on an unknown argument.
+ *
+ * These options have no affect on how the mongos runs.
+ * Setting either or both to *any* value will provoke a warning message
+ * and nothing more.
+ */
sharding_options
.addOptionChaining("noscripting", "noscripting", moe::Switch, "disable scripting engine")
+ .hidden()
.setSources(moe::SourceAllLegacy);
+ general_options
+ .addOptionChaining(
+ "security.javascriptEnabled", "", moe::Bool, "Enable javascript execution")
+ .hidden()
+ .setSources(moe::SourceYAMLConfig);
options->addSection(general_options).transitional_ignore();
@@ -185,8 +201,9 @@ Status storeMongosOptions(const moe::Environment& params) {
params["replication.localPingThresholdMs"].as<int>();
}
- if (params.count("noscripting")) {
- // This option currently has no effect for mongos
+ if (params.count("noscripting") || params.count("security.javascriptEnabled")) {
+ warning() << "The Javascript enabled/disabled options are not supported for mongos. "
+ "(\"noscripting\" and/or \"security.javascriptEnabled\" are set.)";
}
if (!params.count("sharding.configDB")) {