@@ -290,6 +290,12 @@ uint32_t OCIContainer::startContainer(const JsonObject ¶meters, JsonObject &
290
290
std::string bundlePath = parameters[" bundlePath" ].String ();
291
291
std::string command = parameters[" command" ].String ();
292
292
std::string westerosSocket = parameters[" westerosSocket" ].String ();
293
+ std::vector<std::string> envs = std::vector<std::string>();
294
+ if (parameters.HasLabel (" environmentVariables" ))
295
+ {
296
+ std::string environmentVariables = parameters[" environmentVariables" ].String ();
297
+ split (environmentVariables, ' &' , envs);
298
+ }
293
299
294
300
// Can be used to pass file descriptors to container construction.
295
301
// Currently unsupported, see DobbyProxy::startContainerFromBundle().
@@ -335,7 +341,7 @@ uint32_t OCIContainer::startContainer(const JsonObject ¶meters, JsonObject &
335
341
}
336
342
337
343
LOGINFO (" startContainerFromBundle: id: %s, containerPath: %s, command: %s, westerosSocket: %s" , id.c_str (), encrypted ? containerPath.c_str () : bundlePath.c_str (), command.c_str (), westerosSocket.c_str ());
338
- descriptor = mDobbyProxy ->startContainerFromBundle (id, encrypted ? containerPath : bundlePath, emptyList, command, westerosSocket);
344
+ descriptor = mDobbyProxy ->startContainerFromBundle (id, encrypted ? containerPath : bundlePath, emptyList, command, westerosSocket, envs );
339
345
}
340
346
341
347
// startContainer returns -1 on failure
@@ -726,6 +732,26 @@ void OCIContainer::onVerityFailed(const std::string& name)
726
732
}
727
733
}
728
734
735
+ /* *
736
+ * @brief Utility function to split strings based on delimited
737
+ *
738
+ * @param source
739
+ * @param delimiter
740
+ * @return Strings
741
+ */
742
+ void OCIContainer::split (const std::string& source, char delimiter, std::vector<std::string>& outputStrings)
743
+ {
744
+ std::string::size_type previousPosition = 0 , currentPosition = 0 ;
745
+ while ((currentPosition = source.find (delimiter, currentPosition)) != std::string::npos)
746
+ {
747
+ std::string currentString ( source.substr (previousPosition, currentPosition-previousPosition) );
748
+ outputStrings.push_back (currentString);
749
+ previousPosition = currentPosition+1 ;
750
+ currentPosition = currentPosition+1 ;
751
+ }
752
+ outputStrings.push_back (source.substr (previousPosition, currentPosition-previousPosition));
753
+ }
754
+
729
755
// End Internal methods
730
756
731
757
} // namespace Plugin
0 commit comments