fix: split 'server' param into host and port for mqtt bridge

This commit is contained in:
Stefan Strigler 2023-01-09 12:02:38 +01:00
parent d55404cc99
commit c85a988a43
1 changed files with 4 additions and 1 deletions

View File

@ -504,7 +504,10 @@ do_probe(ConnType, Params) ->
end.
host_and_port(mqtt, #{<<"server">> := Server}) ->
Server;
case string:split(Server, ":") of
[Host, Port] -> {Host, list_to_integer(Port)};
_Other -> error(invalid_server, Server)
end;
host_and_port(webhook, #{<<"url">> := Url}) ->
{BaseUrl, _Path} = parse_url(Url),
{ok, #{host := Host, port := Port}} = emqx_http_lib:uri_parse(BaseUrl),