fix: add ip to dashboard listener_on

This commit is contained in:
zhongwencool 2022-09-16 15:36:17 +08:00
parent a90d289480
commit e4c2715842
1 changed files with 10 additions and 3 deletions

View File

@ -458,7 +458,7 @@ list_listeners(Node) when Node =:= node() ->
end, esockd:listeners()), end, esockd:listeners()),
Http = lists:map(fun({Protocol, Opts}) -> Http = lists:map(fun({Protocol, Opts}) ->
#{protocol => Protocol, #{protocol => Protocol,
listen_on => proplists:get_value(port, Opts), listen_on => format_http_bind(Opts),
acceptors => maps:get( num_acceptors acceptors => maps:get( num_acceptors
, proplists:get_value(transport_options, Opts, #{}), 0), , proplists:get_value(transport_options, Opts, #{}), 0),
max_conns => proplists:get_value(max_connections, Opts), max_conns => proplists:get_value(max_connections, Opts),
@ -528,7 +528,7 @@ delete_banned(Who) ->
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Telemtry API %% Telemetry API
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
-ifndef(EMQX_ENTERPRISE). -ifndef(EMQX_ENTERPRISE).
@ -570,7 +570,7 @@ item(route, {Topic, Node}) ->
#{topic => Topic, node => Node}. #{topic => Topic, node => Node}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Internel Functions. %% Internal Functions.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
rpc_call(Node, Fun, Args) -> rpc_call(Node, Fun, Args) ->
@ -603,3 +603,10 @@ max_row_limit() ->
application:get_env(?APP, max_row_limit, ?MAX_ROW_LIMIT). application:get_env(?APP, max_row_limit, ?MAX_ROW_LIMIT).
table_size(Tab) -> ets:info(Tab, size). table_size(Tab) -> ets:info(Tab, size).
format_http_bind(Opts) ->
Port = proplists:get_value(port, Opts),
case proplists:get_value(ip, Opts) of
undefined -> Port;
IP -> {IP, Port}
end.