tonysun83 commented on a change in pull request #3567:
URL: https://github.com/apache/couchdb/pull/3567#discussion_r637127327



##########
File path: src/chttpd/src/chttpd_util.erl
##########
@@ -0,0 +1,43 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(chttpd_util).
+
+
+-export([
+    get_chttpd_config/1,
+    get_chttpd_config/2,
+    get_chttpd_config_integer/2,
+    get_chttpd_config_boolean/2
+]).
+
+
+get_chttpd_config(Key) when is_atom(Key) ->
+    config:get("chttpd", atom_to_list(Key),
+        config:get("httpd", atom_to_list(Key))).
+
+
+get_chttpd_config(Key, Default) when is_atom(Key) ->
+    config:get("chttpd", atom_to_list(Key),
+        config:get("httpd", atom_to_list(Key), Default)).
+
+
+get_chttpd_config_integer(Key, Default)
+        when is_atom(Key) andalso is_integer(Default) ->
+    config:get_integer("chttpd", atom_to_list(Key),
+        config:get_integer("httpd", atom_to_list(Key), Default)).
+
+
+get_chttpd_config_boolean(Key, Default)

Review comment:
       I noticed that previously we were doing something like:
   
   ```
   config:get("httpd", "enable_cors", "false")
   ```
   Similar to what @iilyak asked above, was there a specific reason you decided 
to convert the string key/value pairs into boolean/integer, but then convert 
them back to with `atom_to_list`? Was it to make it more organized between 
different types?
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to