From 272a42b5ac7b28f52e5e71fae540e47278fac9d5 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Mon, 16 Sep 2019 09:18:22 +0800 Subject: [PATCH] Fix the issue with missing SSL configuration --- src/emqx_dashboard.erl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/emqx_dashboard.erl b/src/emqx_dashboard.erl index c7a31d6..c69c7e5 100644 --- a/src/emqx_dashboard.erl +++ b/src/emqx_dashboard.erl @@ -46,12 +46,17 @@ start_listener({Proto, Port, Options}) when Proto == https -> {"/api/v3/[...]", minirest, http_handlers()}], minirest:start_https(listener_name(Proto), ranch_opts(Port, Options), Dispatch). -ranch_opts(Port, Options) -> - NumAcceptors = get_value(num_acceptors, Options, 4), - MaxConnections = get_value(max_connections, Options, 512), +ranch_opts(Port, Options0) -> + NumAcceptors = get_value(num_acceptors, Options0, 4), + MaxConnections = get_value(max_connections, Options0, 512), + Options = lists:foldl(fun({K, _V}, Acc) when K =:= max_connections orelse K =:= num_acceptors-> + Acc; + ({K, V}, Acc)-> + [{K, V} | Acc] + end, [], Options0), #{num_acceptors => NumAcceptors, max_connections => MaxConnections, - socket_opts => [{port, Port}]}. + socket_opts => [{port, Port} | Options]}. stop_listeners() -> lists:foreach(fun(Listener) -> stop_listener(Listener) end, listeners()).