diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2018-12-18 12:52:14 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2018-12-18 12:52:14 -0500 |
commit | 51db7255df7d6085205dee22689082aef6a5391b (patch) | |
tree | a66f1410ca46404b6299e799b2e36f85ae510164 /src/mongo/tools | |
parent | f2a9772e8df59dfc274e84eece8e6dbf33dfdc97 (diff) | |
download | mongo-51db7255df7d6085205dee22689082aef6a5391b.tar.gz |
SERVER-38552 Convert configuration options in src/mongo/tools/mongobridge_options.cpp to IDL
Diffstat (limited to 'src/mongo/tools')
-rw-r--r-- | src/mongo/tools/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/tools/mongobridge_options.cpp | 18 | ||||
-rw-r--r-- | src/mongo/tools/mongobridge_options.idl | 66 | ||||
-rw-r--r-- | src/mongo/tools/mongobridge_options_init.cpp | 2 |
4 files changed, 68 insertions, 19 deletions
diff --git a/src/mongo/tools/SConscript b/src/mongo/tools/SConscript index 418eafbaf78..a085df0f979 100644 --- a/src/mongo/tools/SConscript +++ b/src/mongo/tools/SConscript @@ -14,6 +14,7 @@ mongobridge = env.Program( "bridge.cpp", "bridge_commands.cpp", "mongobridge_options.cpp", + env.Idlc("mongobridge_options.idl")[0], "mongobridge_options_init.cpp" ], LIBDEPS=[ diff --git a/src/mongo/tools/mongobridge_options.cpp b/src/mongo/tools/mongobridge_options.cpp index 732425c5a55..355dcfd9c14 100644 --- a/src/mongo/tools/mongobridge_options.cpp +++ b/src/mongo/tools/mongobridge_options.cpp @@ -44,21 +44,6 @@ namespace mongo { MongoBridgeGlobalParams mongoBridgeGlobalParams; -Status addMongoBridgeOptions(moe::OptionSection* options) { - options->addOptionChaining("help", "help", moe::Switch, "show this usage information"); - - options->addOptionChaining("port", "port", moe::Int, "port to listen on for MongoDB messages"); - - options->addOptionChaining("seed", "seed", moe::Long, "random seed to use"); - - options->addOptionChaining("dest", "dest", moe::String, "URI of remote MongoDB process"); - - options->addOptionChaining("verbose", "verbose", moe::String, "log more verbose output") - .setImplicit(moe::Value(std::string("v"))); - - return Status::OK(); -} - void printMongoBridgeHelp(std::ostream* out) { *out << "Usage: mongobridge --port <port> --dest <dest> [ --seed <seed> ] [ --verbose <vvv> ]" " [ --help ]" @@ -85,9 +70,6 @@ Status storeMongoBridgeOptions(const moe::Environment& params, return {ErrorCodes::BadValue, "Missing required option: --dest"}; } - mongoBridgeGlobalParams.port = params["port"].as<int>(); - mongoBridgeGlobalParams.destUri = params["dest"].as<std::string>(); - if (!params.count("seed")) { std::unique_ptr<SecureRandom> seedSource{SecureRandom::create()}; mongoBridgeGlobalParams.seed = seedSource->nextInt64(); diff --git a/src/mongo/tools/mongobridge_options.idl b/src/mongo/tools/mongobridge_options.idl new file mode 100644 index 00000000000..e6d2018d597 --- /dev/null +++ b/src/mongo/tools/mongobridge_options.idl @@ -0,0 +1,66 @@ +# Copyright (C) 2018-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" + configs: + source: [ cli] + cpp_includes: + - "mongo/tools/mongobridge_options.h" + +imports: + - "mongo/idl/basic_types.idl" + +configs: + help: + description: "show this usage information" + short_name: help + arg_vartype: Switch + + port: + description: "port to listen on for MongoDB messages" + short_name: port + arg_vartype: Int + cpp_varname: mongoBridgeGlobalParams.port + + seed: + description: "random seed to use" + short_name: seed + arg_vartype: Long + + dest: + description: "URI of remote MongoDB process" + short_name: dest + arg_vartype: String + cpp_varname: mongoBridgeGlobalParams.destUri + + vebose: + description: "log more verbose output" + short_name: verbose + arg_vartype: String + implicit: "v" diff --git a/src/mongo/tools/mongobridge_options_init.cpp b/src/mongo/tools/mongobridge_options_init.cpp index 20371223b10..4bbc3ee1e1f 100644 --- a/src/mongo/tools/mongobridge_options_init.cpp +++ b/src/mongo/tools/mongobridge_options_init.cpp @@ -43,7 +43,7 @@ MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(MongoBridgeOptions)(InitializerContext* c auto ret = addMessageCompressionOptions(&moe::startupOptions, false); if (!ret.isOK()) return ret; - return addMongoBridgeOptions(&moe::startupOptions); + return Status::OK(); } MONGO_STARTUP_OPTIONS_VALIDATE(MongoBridgeOptions)(InitializerContext* context) { |