diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-04-03 10:29:48 -0400 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-04-10 10:41:36 -0400 |
commit | cb2b7de230a656986553e99f4a9f3a64f6be8a1e (patch) | |
tree | cf185762899c6c513aa66eb814fa5688b6cdac82 /src/mongo/client/embedded/embedded.cpp | |
parent | fb9aed12d2ab29884f2567ae9e60e021790823bd (diff) | |
download | mongo-cb2b7de230a656986553e99f4a9f3a64f6be8a1e.tar.gz |
SERVER-32487 Embedded CAPI takes a yaml config string instead of argc and argv.
Diffstat (limited to 'src/mongo/client/embedded/embedded.cpp')
-rw-r--r-- | src/mongo/client/embedded/embedded.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/client/embedded/embedded.cpp b/src/mongo/client/embedded/embedded.cpp index 955b221d0f3..328217bd157 100644 --- a/src/mongo/client/embedded/embedded.cpp +++ b/src/mongo/client/embedded/embedded.cpp @@ -167,11 +167,17 @@ void shutdown(ServiceContext* srvContext) { } -ServiceContext* initialize(int argc, char* argv[], char** envp) { +ServiceContext* initialize(const char* yaml_config) { srand(static_cast<unsigned>(curTimeMicros64())); setGlobalServiceContext(createServiceContext()); - Status status = mongo::runGlobalInitializers(argc, argv, envp, getGlobalServiceContext()); + + // yaml_config is passed to the options parser through the argc/argv interface that already + // existed. If it is nullptr then use 0 count which will be interpreted as empty string. + const char* argv[2] = {yaml_config, nullptr}; + + Status status = + mongo::runGlobalInitializers(yaml_config ? 1 : 0, argv, nullptr, getGlobalServiceContext()); uassertStatusOKWithContext(status, "Global initilization failed"); Client::initThread("initandlisten"); |