Merge pull request #8480 from zhongwencool/improve-listener-start-log
chore: improve the dashboard listener startup log
This commit is contained in:
commit
4157ff6984
|
@ -14,6 +14,11 @@
|
||||||
* Fix AuthN JWKS SSL schema. Using schema in `emqx_schema`. [#8458](https://github.com/emqx/emqx/pull/8458)
|
* Fix AuthN JWKS SSL schema. Using schema in `emqx_schema`. [#8458](https://github.com/emqx/emqx/pull/8458)
|
||||||
* `sentinel` field should be required when AuthN/AuthZ Redis using sentinel mode. [#8458](https://github.com/emqx/emqx/pull/8458)
|
* `sentinel` field should be required when AuthN/AuthZ Redis using sentinel mode. [#8458](https://github.com/emqx/emqx/pull/8458)
|
||||||
|
|
||||||
|
## Enhancements
|
||||||
|
|
||||||
|
* Improve the dashboard listener startup log, the listener name is no longer spliced with port information,
|
||||||
|
and the colon(:) is no longer displayed when IP is not specified.[#8480](https://github.com/emqx/emqx/pull/8480)
|
||||||
|
|
||||||
# 5.0.3
|
# 5.0.3
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
|
@ -493,7 +493,7 @@ merge_default(Options) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
format_addr(Port) when is_integer(Port) ->
|
format_addr(Port) when is_integer(Port) ->
|
||||||
io_lib:format(":~w", [Port]);
|
io_lib:format("~w", [Port]);
|
||||||
%% Print only the port number when bound on all interfaces
|
%% Print only the port number when bound on all interfaces
|
||||||
format_addr({{0, 0, 0, 0}, Port}) ->
|
format_addr({{0, 0, 0, 0}, Port}) ->
|
||||||
format_addr(Port);
|
format_addr(Port);
|
||||||
|
|
|
@ -159,7 +159,7 @@ listeners(Listeners) ->
|
||||||
maps:get(enable, Conf) andalso
|
maps:get(enable, Conf) andalso
|
||||||
begin
|
begin
|
||||||
{Conf1, Bind} = ip_port(Conf),
|
{Conf1, Bind} = ip_port(Conf),
|
||||||
{true, {listener_name(Protocol, Conf1), Protocol, Bind, ranch_opts(Conf1)}}
|
{true, {listener_name(Protocol), Protocol, Bind, ranch_opts(Conf1)}}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
maps:to_list(Listeners)
|
maps:to_list(Listeners)
|
||||||
|
@ -208,19 +208,8 @@ ranch_opts(Options) ->
|
||||||
filter_false(_K, false, S) -> S;
|
filter_false(_K, false, S) -> S;
|
||||||
filter_false(K, V, S) -> [{K, V} | S].
|
filter_false(K, V, S) -> [{K, V} | S].
|
||||||
|
|
||||||
listener_name(Protocol, #{port := Port, ip := IP}) ->
|
listener_name(Protocol) ->
|
||||||
Name =
|
list_to_atom(atom_to_list(Protocol) ++ ":dashboard").
|
||||||
"dashboard:" ++
|
|
||||||
atom_to_list(Protocol) ++ ":" ++
|
|
||||||
inet:ntoa(IP) ++ ":" ++
|
|
||||||
integer_to_list(Port),
|
|
||||||
list_to_atom(Name);
|
|
||||||
listener_name(Protocol, #{port := Port}) ->
|
|
||||||
Name =
|
|
||||||
"dashboard:" ++
|
|
||||||
atom_to_list(Protocol) ++ ":" ++
|
|
||||||
integer_to_list(Port),
|
|
||||||
list_to_atom(Name).
|
|
||||||
|
|
||||||
authorize(Req) ->
|
authorize(Req) ->
|
||||||
case cowboy_req:parse_header(<<"authorization">>, Req) of
|
case cowboy_req:parse_header(<<"authorization">>, Req) of
|
||||||
|
|
Loading…
Reference in New Issue