Browse Source

provide helper stuff via env

Provide MANTICORE_HELPER_URL env with the URL of a helper.
If such is set, daemon will ignore any 'buddy_path' param, will NOT
start and/or manage and trace any external application, provided by this
 param, and also will not try to kill any processes on stop. Instead,
 helper will be considered as always available by this env as url.

That is intended mainly for fixing debug capabilities (as some debuggers
 are confused when any external applications are forked/executed during
 startup), but also that may be used to trully break out external helper
  from the daemon, and manage it independently.

 That fixes #3225
klirichek 3 years ago
parent
commit
72e30daef5
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/searchdbuddy.cpp

+ 10 - 0
src/searchdbuddy.cpp

@@ -306,6 +306,16 @@ CSphString GetUrl ( const ListenerDesc_t & tDesc )
 
 void BuddyStart ( const CSphString & sConfigPath, bool bHasBuddyPath, const VecTraits_T<ListenerDesc_t> & dListeners, bool bTelemetry, int iThreads )
 {
+	const char* szHelperUrl = getenv ( "MANTICORE_HELPER_URL" );
+	if ( szHelperUrl )
+	{
+		// debug mode - don't start anything and consider env url valid and available
+		// - can start any kind of helper externally and just route to it using provided URL
+		g_sUrlBuddy = szHelperUrl;
+		g_eBuddy = BuddyState_e::WORK;
+		return;
+	}
+
 	CSphString sPath = BuddyGetPath ( sConfigPath, bHasBuddyPath );
 	if ( sPath.IsEmpty() )
 		return;