summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2019-03-01 17:03:55 +0000
committerSara Golemon <sara.golemon@mongodb.com>2019-03-02 22:30:30 +0000
commit857d20826c15d6a8fccf0b2b364bf7c4791220a1 (patch)
treefadf76fb3637b14c211f36e3d9d2dcd814f8c9de /src/mongo
parent5a2c07a84088b215af9f1b1b160103cd8ecd76b3 (diff)
downloadmongo-857d20826c15d6a8fccf0b2b364bf7c4791220a1.tar.gz
SERVER-39907 Migrate enable test commands to IDL
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/commands/SConscript3
-rw-r--r--src/mongo/db/commands/test_commands_enabled.cpp15
-rw-r--r--src/mongo/db/commands/test_commands_enabled.idl39
3 files changed, 44 insertions, 13 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 11b73b6f750..c85c1edce37 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -9,9 +9,10 @@ env.Library(
target="test_commands_enabled",
source=[
"test_commands_enabled.cpp",
+ env.Idlc('test_commands_enabled.idl')[0],
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/db/server_parameters',
+ '$BUILD_DIR/mongo/idl/server_parameter',
"server_status_core",
]
)
diff --git a/src/mongo/db/commands/test_commands_enabled.cpp b/src/mongo/db/commands/test_commands_enabled.cpp
index 598e52e0606..670ef0567e3 100644
--- a/src/mongo/db/commands/test_commands_enabled.cpp
+++ b/src/mongo/db/commands/test_commands_enabled.cpp
@@ -30,25 +30,16 @@
#include "mongo/platform/basic.h"
#include "mongo/db/commands/test_commands_enabled.h"
-
-#include "mongo/db/server_parameters.h"
+#include "mongo/db/commands/test_commands_enabled_gen.h"
namespace mongo {
-namespace {
-
-bool enabled = false;
-
-ExportedServerParameter<bool, ServerParameterType::kStartupOnly> testCommandsParameter(
- ServerParameterSet::getGlobal(), "enableTestCommands", &enabled);
-
-} // namespace
bool getTestCommandsEnabled() {
- return enabled;
+ return gEnableTestCommands;
}
void setTestCommandsEnabled(bool b) {
- enabled = b;
+ gEnableTestCommands = b;
}
} // namespace mongo
diff --git a/src/mongo/db/commands/test_commands_enabled.idl b/src/mongo/db/commands/test_commands_enabled.idl
new file mode 100644
index 00000000000..68614aef831
--- /dev/null
+++ b/src/mongo/db/commands/test_commands_enabled.idl
@@ -0,0 +1,39 @@
+# Copyright (C) 2019-present MongoDB, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the Server Side Public License, version 1,
+# as published by MongoDB, Inc.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# Server Side Public License for more details.
+#
+# You should have received a copy of the Server Side Public License
+# along with this program. If not, see
+# <http://www.mongodb.com/licensing/server-side-public-license>.
+#
+# As a special exception, the copyright holders give permission to link the
+# code of portions of this program with the OpenSSL library under certain
+# conditions as described in each individual source file and distribute
+# linked combinations including the program with the OpenSSL library. You
+# must comply with the Server Side Public License in all respects for
+# all of the code used other than as permitted herein. If you modify file(s)
+# with this exception, you may extend this exception to your version of the
+# file(s), but you are not obligated to do so. If you do not wish to do so,
+# delete this exception statement from your version. If you delete this
+# exception statement from all source files in the program, then also delete
+# it in the license file.
+#
+
+global:
+ cpp_namespace: "mongo"
+
+server_parameters:
+ enableTestCommands:
+ description: 'Enable test commands'
+ set_at: startup
+ cpp_vartype: bool
+ cpp_varname: gEnableTestCommands
+ default: false
+