@@ -218,6 +218,40 @@ inline void parseMainCommandArgs(int argc, char* argv[])
218
218
}
219
219
}
220
220
221
+ inline void setEvns ()
222
+ {
223
+ std::string scomponentGroupOrder = " 0" ;
224
+ std::string scomponentGlobalOrder = " 0" ;
225
+ std::string scomponentID = " 0" ;
226
+
227
+ if (g_componentGroupOrder > 0 )
228
+ {
229
+ int32 icomponentGroupOrder = g_componentGroupOrder;
230
+ scomponentGroupOrder = KBEngine::StringConv::val2str (icomponentGroupOrder);
231
+ }
232
+
233
+ if (g_componentGlobalOrder > 0 )
234
+ {
235
+ int32 icomponentGlobalOrder = g_componentGlobalOrder;
236
+ scomponentGlobalOrder = KBEngine::StringConv::val2str (icomponentGlobalOrder);
237
+ }
238
+
239
+ {
240
+ uint64 v = g_componentID;
241
+ scomponentID = KBEngine::StringConv::val2str (v);
242
+ }
243
+
244
+ #if KBE_PLATFORM == PLATFORM_WIN32
245
+ _putenv ((std::string (" KBE_COMPONENTID=" ) + scomponentID).c_str ());
246
+ _putenv ((std::string (" KBE_GLOBALID=" ) + scomponentGlobalOrder).c_str ());
247
+ _putenv ((std::string (" KBE_GROUPID=" ) + scomponentGroupOrder).c_str ());
248
+ #else
249
+ setenv (" KBE_COMPONENTID" , scomponentID.c_str (), 1 );
250
+ setenv (" KBE_GLOBALID" , scomponentGlobalOrder.c_str (), 1 );
251
+ setenv (" KBE_GROUPID" , scomponentGroupOrder.c_str (), 1 );
252
+ #endif
253
+ }
254
+
221
255
template <class CLIENT_APP >
222
256
int kbeMainT (int argc, char * argv[], COMPONENT_TYPE componentType,
223
257
int32 extlisteningPort_min = -1 , int32 extlisteningPort_max = -1 , const char * extlisteningInterface = " " ,
@@ -226,6 +260,7 @@ int kbeMainT(int argc, char * argv[], COMPONENT_TYPE componentType,
226
260
g_componentID = genUUID64 ();
227
261
g_componentType = componentType;
228
262
parseMainCommandArgs (argc, argv);
263
+ setEvns ();
229
264
230
265
if (!loadConfig ())
231
266
{
0 commit comments