chore: delete bad parse_bridge function clause

This commit is contained in:
Zaiming (Stone) Shi 2022-09-23 11:52:12 +02:00
parent c4f7d385b5
commit 7b601bf970
3 changed files with 2 additions and 5 deletions

View File

@ -334,8 +334,6 @@ get_matched_bridges(Topic) ->
Bridges
).
%% TODO: refactor to return bridge type, and bridge name directly
%% so there is no need to parse the id back to type and name at where it is used
get_matched_bridge_id(_BType, #{enable := false}, _Topic, _BName, Acc) ->
Acc;
get_matched_bridge_id(BType, #{local_topic := Filter}, Topic, BName, Acc) when

View File

@ -71,8 +71,6 @@ bridge_id(BridgeType, BridgeName) ->
Type = bin(BridgeType),
<<Type/binary, ":", Name/binary>>.
parse_bridge_id(<<"bridge:", BridgeId/binary>>) ->
parse_bridge_id(BridgeId);
parse_bridge_id(BridgeId) ->
case string:split(bin(BridgeId), ":", all) of
[Type, Name] -> {binary_to_atom(Type, utf8), binary_to_atom(Name, utf8)};

View File

@ -383,7 +383,8 @@ config(Args) ->
#{atom_key => true}
),
InstId = maps:get("instance_id", Args),
Parsed#{bridge_name => erlang:element(2, emqx_bridge_resource:parse_bridge_id(InstId))}.
<<"bridge:", BridgeId>> = InstId,
Parsed#{bridge_name => erlang:element(2, emqx_bridge_resource:parse_bridge_id(BridgeId))}.
hocon_config(Args) ->
AuthConf = maps:get("authentication", Args),