diff options
-rw-r--r-- | src/couch/src/couch_httpd.erl | 2 | ||||
-rw-r--r-- | src/couch/src/couch_secondary_sup.erl | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl index 73d3c1704..65291e3da 100644 --- a/src/couch/src/couch_httpd.erl +++ b/src/couch/src/couch_httpd.erl @@ -38,7 +38,7 @@ -export([validate_bind_address/1]). -export([check_max_request_length/1]). -export([handle_request/1]). - +-export([set_auth_handlers/0]). -define(HANDLER_NAME_IN_MODULE_POS, 6). -define(MAX_DRAIN_BYTES, 1048576). diff --git a/src/couch/src/couch_secondary_sup.erl b/src/couch/src/couch_secondary_sup.erl index 0f46ec85f..9c7d414d0 100644 --- a/src/couch/src/couch_secondary_sup.erl +++ b/src/couch/src/couch_secondary_sup.erl @@ -30,14 +30,18 @@ init([]) -> {index_server, {couch_index_server, start_link, []}}, {query_servers, {couch_proc_manager, start_link, []}}, {vhosts, {couch_httpd_vhost, start_link, []}}, - {httpd, {couch_httpd, start_link, []}}, {uuids, {couch_uuids, start, []}}, {auth_cache, {couch_auth_cache, start_link, []}} ], + MaybeHttp = case http_enabled() of + true -> [{httpd, {couch_httpd, start_link, []}}]; + false -> couch_httpd:set_auth_handlers(), [] + end, + MaybeHttps = case https_enabled() of true -> [{httpsd, {chttpd, start_link, [https]}}]; - _False -> [] + false -> [] end, Children = SecondarySupervisors ++ [ @@ -52,10 +56,13 @@ init([]) -> [Module]} end || {Name, Spec} - <- Daemons ++ MaybeHttps, Spec /= ""], + <- Daemons ++ MaybeHttp ++ MaybeHttps, Spec /= ""], {ok, {{one_for_one, 50, 3600}, couch_epi:register_service(couch_db_epi, Children)}}. +http_enabled() -> + config:get_boolean("httpd", "enable", false). + https_enabled() -> % 1. [ssl] enable = true | false % 2. if [daemons] httpsd == {chttpd, start_link, [https]} -> pretend true as well |