mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Improve ACME options validation
This commit is contained in:
parent
382fb62f29
commit
224a3e13c9
@ -1203,19 +1203,20 @@ generate_key() ->
|
|||||||
%% Option Parsing Code
|
%% Option Parsing Code
|
||||||
%%
|
%%
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
parse_acme_opts(AcmeOpt) ->
|
|
||||||
[parse_acme_opt(Opt) || Opt <- AcmeOpt].
|
|
||||||
|
|
||||||
|
|
||||||
parse_acme_opt({ca_url, CaUrl}) when is_bitstring(CaUrl) ->
|
|
||||||
{ca_url, binary_to_list(CaUrl)};
|
|
||||||
parse_acme_opt({contact, Contact}) when is_bitstring(Contact) ->
|
|
||||||
{contact, Contact}.
|
|
||||||
|
|
||||||
-spec opt_type(acme) -> fun((acme_config()) -> (acme_config()));
|
-spec opt_type(acme) -> fun((acme_config()) -> (acme_config()));
|
||||||
(atom()) -> [atom()].
|
(atom()) -> [atom()].
|
||||||
opt_type(acme) ->
|
opt_type(acme) ->
|
||||||
fun parse_acme_opts/1;
|
fun(L) ->
|
||||||
|
lists:map(
|
||||||
|
fun({ca_url, URL}) ->
|
||||||
|
URL1 = binary_to_list(URL),
|
||||||
|
{ok, _} = http_uri:parse(URL1),
|
||||||
|
URL1;
|
||||||
|
({contact, Contact}) ->
|
||||||
|
[<<_, _/binary>>, <<_, _/binary>>] =
|
||||||
|
binary:split(Contact, <<":">>),
|
||||||
|
Contact
|
||||||
|
end, L)
|
||||||
|
end;
|
||||||
opt_type(_) ->
|
opt_type(_) ->
|
||||||
[acme].
|
[acme].
|
||||||
|
Loading…
Reference in New Issue
Block a user