fix(emqx_authz_api_sources): use merge replace foldl

This commit is contained in:
EMQ-YangM 2022-03-14 14:20:25 +08:00
parent 740b3870bf
commit 258d2e9e03
1 changed files with 1 additions and 4 deletions

View File

@ -232,10 +232,7 @@ source(get, #{bindings := #{type := Type}}) ->
#{annotations := #{id := ResourceId }} -> #{annotations := #{id := ResourceId }} ->
case lookup_from_all_nodes(ResourceId) of case lookup_from_all_nodes(ResourceId) of
{ok, StatusAndMetrics} -> {ok, StatusAndMetrics} ->
Fun = fun ({Key, Val}, Map) -> maps:put(Key, Val, Map) end, {200, maps:merge(read_certs(Source), StatusAndMetrics)};
{200, lists:foldl(Fun,
read_certs(Source),
maps:to_list(StatusAndMetrics))};
{error, ErrorMsg} -> {500, ErrorMsg} {error, ErrorMsg} -> {500, ErrorMsg}
end; end;
_ -> {200, read_certs(Source)} _ -> {200, read_certs(Source)}