From 16da9cbcb42df25b92ab3c242a4c438c37d4babb Mon Sep 17 00:00:00 2001 From: firest Date: Tue, 7 Jun 2022 09:58:02 +0800 Subject: [PATCH] fix(gateway): gateway listen-address add support for `host:port` format --- apps/emqx_gateway/src/emqx_gateway_conf.erl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/emqx_gateway/src/emqx_gateway_conf.erl b/apps/emqx_gateway/src/emqx_gateway_conf.erl index 7c883c1c5..1d546c7d7 100644 --- a/apps/emqx_gateway/src/emqx_gateway_conf.erl +++ b/apps/emqx_gateway/src/emqx_gateway_conf.erl @@ -200,14 +200,10 @@ bind2str(LConf = #{bind := Bind}) when is_binary(Bind) -> bind2str(LConf = #{<<"bind">> := Bind}) when is_binary(Bind) -> LConf. -get_bind(#{bind := Bind}) when is_integer(Bind) -> - Bind; -get_bind(#{<<"bind">> := Bind}) when is_integer(Bind) -> - Bind; -get_bind(#{bind := Bind}) when is_binary(Bind) -> - erlang:binary_to_integer(Bind); -get_bind(#{<<"bind">> := Bind}) when is_binary(Bind) -> - erlang:binary_to_integer(Bind). +get_bind(#{bind := Bind}) -> + emqx_gateway_utils:parse_listenon(Bind); +get_bind(#{<<"bind">> := Bind}) -> + emqx_gateway_utils:parse_listenon(Bind). -spec listeners(atom_or_bin()) -> [map()]. listeners(GwName0) ->