fix(emqx_authz_api_sources): use merge replace foldl
This commit is contained in:
parent
740b3870bf
commit
258d2e9e03
|
@ -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)}
|
||||||
|
|
Loading…
Reference in New Issue