diff options
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"); |