@@ -335,6 +335,50 @@ end}.
335335{mapping , " ssl_options.crl_check" , " rabbit.ssl_options.crl_check" ,
336336 [{datatype , [{enum , [true , false , peer , best_effort ]}]}]}.
337337
338+ {mapping , " ssl_options.crl_sources.$index" , " rabbit.ssl_options.crl_cache" ,
339+ [{datatype , {enum , [http , dir ]}}]}.
340+
341+ {mapping , " ssl_options.crl_sources.$index.timeout" , " rabbit.ssl_options.crl_cache" ,
342+ [{datatype , integer }]}.
343+
344+ {mapping , " ssl_options.crl_sources.$index.path" , " rabbit.ssl_options.crl_cache" ,
345+ [{datatype , string }]}.
346+
347+ {translation , " rabbit.ssl_options.crl_cache" ,
348+ fun (Conf ) ->
349+ Entries = cuttlefish_variable :filter_by_prefix (" ssl_options.crl_sources" , Conf ),
350+ case Entries of
351+ [] -> cuttlefish :unset ();
352+ _ ->
353+ Sources = lists :foldl (
354+ fun ({[_ , _ , Index , Opt ], Val }, Acc ) ->
355+ K = list_to_atom (Index ),
356+ [{K , {list_to_existing_atom (Opt ), Val }} | Acc ];
357+ ({[_ , _ , Index ], Val }, Acc ) ->
358+ K = list_to_atom (Index ),
359+ [{K , {type , Val }} | Acc ]
360+ end , [], Entries ),
361+ Grouped = maps :to_list (maps :groups_from_list (fun ({K , _ }) -> K end , fun ({_ , V }) -> V end , Sources )),
362+ CrlOpts = lists :map (
363+ fun ({_ , Props }) ->
364+ Type = proplists :get_value (type , Props ),
365+ case Type of
366+ http ->
367+ case proplists :get_keys (Props ) -- [type , timeout ] of
368+ [] -> {http , proplists :get_value (timeout , Props , 5000 )};
369+ _ -> cuttlefish :invalid (" http source only supports 'timeout' option" )
370+ end ;
371+ dir ->
372+ case proplists :get_keys (Props ) -- [type , path ] of
373+ [] -> {dir , proplists :get_value (path , Props )};
374+ _ -> cuttlefish :invalid (" dir source only supports 'path' option" )
375+ end
376+ end
377+ end , Grouped ),
378+ {ssl_crl_cache , {internal , CrlOpts }}
379+ end
380+ end }.
381+
338382{mapping , " ssl_options.depth" , " rabbit.ssl_options.depth" ,
339383 [{datatype , integer }, {validators , [" byte" ]}]}.
340384
0 commit comments