From cb2b7de230a656986553e99f4a9f3a64f6be8a1e Mon Sep 17 00:00:00 2001 From: Henrik Edin Date: Tue, 3 Apr 2018 10:29:48 -0400 Subject: SERVER-32487 Embedded CAPI takes a yaml config string instead of argc and argv. --- src/mongo/client/embedded/embedded.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/mongo/client/embedded/embedded.cpp') 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(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"); -- cgit v1.2.1