diff options
author | Jan Lehnardt <jan@apache.org> | 2018-06-29 19:31:44 +0200 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2018-07-09 14:16:00 +0200 |
commit | 54577f13de4b11ddecd8fb3ca67cde754cd4c94d (patch) | |
tree | 3c3de2202a0596b0991c5a5e38156a4f93c96c10 | |
parent | 73f15655d46bf9bb4b47e363379c9e2fe030dd26 (diff) | |
download | couchdb-54577f13de4b11ddecd8fb3ca67cde754cd4c94d.tar.gz |
allow socket server configuration for TLS httpd
-rw-r--r-- | src/chttpd/src/chttpd.erl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl index ae94ae6fc..c0179babc 100644 --- a/src/chttpd/src/chttpd.erl +++ b/src/chttpd/src/chttpd.erl @@ -104,10 +104,12 @@ start_link(https) -> end, SslOpts = ServerOpts ++ ClientOpts, - Options = + Options0 = [{port, Port}, {ssl, true}, {ssl_opts, SslOpts}], + CustomServerOpts = get_server_options("httpsd"), + Options = merge_server_options(Options0, CustomServerOpts), start_link(https, Options). start_link(Name, Options) -> @@ -124,9 +126,8 @@ start_link(Name, Options) -> {name, Name}, {ip, IP} ], - ServerOptsCfg = config:get("chttpd", "server_options", "[]"), - {ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg), - Options2 = lists:keymerge(1, lists:sort(Options1), lists:sort(ServerOpts)), + ServerOpts = get_server_options("chttpd"), + Options2 = merge_server_options(Options1, ServerOpts), case mochiweb_http:start(Options2) of {ok, Pid} -> {ok, Pid}; @@ -135,6 +136,14 @@ start_link(Name, Options) -> {error, Reason} end. +get_server_options(Module) -> + ServerOptsCfg = config:get(Module, "server_options", "[]"), + {ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg), + ServerOpts. + +merge_server_options(A, B) -> + lists:keymerge(1, lists:sort(A), lists:sort(B)). + stop() -> catch mochiweb_http:stop(https), mochiweb_http:stop(?MODULE). |