@@ -18,13 +18,12 @@ extract_key_as_binary({Name,_}) -> list_to_binary(Name).
1818
1919-spec translate_oauth_resource_servers ([{list (), binary ()}]) -> map ().
2020translate_oauth_resource_servers (Conf ) ->
21- % % Note: Conf must be reversed because cuttlefish_generator:transform_datatypes
22- % % reverse the order of the configuration from rabbitmq.conf.
23- % % Exactly on this line: `{[{Variable, NewValue}|Acc], ErrorAcc};`
24-
21+ % % `lists:reverse/1` must be reversed because cuttlefish_generator:transform_datatypes
22+ % % prepends new values as it translates rabbitmq.conf, like so:
23+ % % {[{Variable, NewValue}|Acc], ErrorAcc};
2524 Settings = cuttlefish_variable :filter_by_prefix (
2625 " management.oauth_resource_servers" , lists :reverse (Conf )),
27-
26+
2827 Map = merge_list_of_maps ([
2928 extract_resource_server_properties (Settings ),
3029 extract_resource_server_endpoint_params (oauth_authorization_endpoint_params , Settings ),
@@ -53,12 +52,12 @@ convert_list_to_binary(V) when is_list(V) ->
5352convert_list_to_binary (V ) ->
5453 V .
5554
56- extract_resource_server_properties (Settings ) ->
55+ extract_resource_server_properties (Settings ) ->
5756 OAuthResourceServers = [{Name , {list_to_atom (Key ), convert_list_to_binary (V )}}
5857 || {[" management" ," oauth_resource_servers" , Name , Key ], V } <- Settings ],
5958 lists :foldl (fun ({K , Value }, Acc ) ->
6059 Key = list_to_binary (K ),
61- Attrs = case maps :get (Key , Acc , []) of
60+ Attrs = case maps :get (Key , Acc , []) of
6261 [] -> [] ++ [{index , maps :size (Acc )+ 1 }, Value ];
6362 List -> List ++ [Value ]
6463 end ,
0 commit comments