janl commented on a change in pull request #1602: Remove runtime 
configurability of core system components
URL: https://github.com/apache/couchdb/pull/1602#discussion_r218133665
 
 

 ##########
 File path: src/couch/src/couch_proc_manager.erl
 ##########
 @@ -372,12 +372,59 @@ new_proc(Client) ->
     end,
     exit(Resp).
 
+get_env_for_spec(Spec, Target) ->
+    % loop over os:getenv(), match SPEC_TARGET
+    lists:filtermap(fun(VarName) ->
+        SpecStr = Spec ++ Target,
+        case string:tokens(VarName, "=") of
+            [SpecStr, Cmd] -> {true, Cmd};
+            _Else -> false
+        end
+    end, os:getenv()).
+
+get_query_server(LangStr) ->
+    % look for COUCH_QUERY_SERVER_LANGSTR in env
+    % if exists, return value, else undefined
+    UpperLangString = string:to_upper(LangStr),
+    case get_env_for_spec("COUCHDB_QUERY_SERVER_", UpperLangString) of
+        [] -> undefined;
+        [Command] -> Command
+    end.
+
+native_query_server_enabled() ->
+    % 1. [native_query_server] enable_erlang_query_server = true | false
+    % 2. if [native_query_server] erlang == {couch_native_process, start_link, 
[]} -> pretend true as well
+    NativeEnabled = config:get_boolean("native_query_servers", 
"enable_erlang_query_server", false),
+    NativeLegacyConfig = config:get("native_query_servers", "erlang", ""),
+    NativeLegacyEnabled = NativeLegacyConfig =:= "{couch_native_process, 
start_link, []}",
+
+    % there surely is a more elegant way to do this that eludes me at present
+    case {NativeEnabled, NativeLegacyEnabled} of
 
 Review comment:
   omg thanks :D

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to