Remove a clause that would never match
This commit is contained in:
parent
2273797d36
commit
0d615080f2
|
|
@ -60,27 +60,22 @@
|
|||
{translation,
|
||||
"rabbitmq_auth_backend_oauth2.key_config.signing_keys",
|
||||
fun(Conf) ->
|
||||
case cuttlefish:conf_get("auth_oauth2.signing_keys", Conf, undefined) of
|
||||
none ->
|
||||
#{};
|
||||
_ ->
|
||||
Settings = cuttlefish_variable:filter_by_prefix("auth_oauth2.signing_keys", Conf),
|
||||
ReadFileFun =
|
||||
fun(Path) ->
|
||||
case file:read_file(Path) of
|
||||
{ok, Bin} ->
|
||||
string:trim(Bin, trailing, "\n");
|
||||
_ ->
|
||||
% cuttlefish validators are not invoked for properties with $variables?
|
||||
cuttlefish:invalid("file does not exist or cannot be read by the node")
|
||||
end
|
||||
end,
|
||||
SigningKeys =
|
||||
lists:map(fun(Key) ->
|
||||
{Id, Path} = Key,
|
||||
{list_to_binary(lists:last(Id)), ReadFileFun(Path)}
|
||||
end,
|
||||
Settings),
|
||||
maps:from_list(SigningKeys)
|
||||
end
|
||||
Settings = cuttlefish_variable:filter_by_prefix("auth_oauth2.signing_keys", Conf),
|
||||
TryReadingFileFun =
|
||||
fun(Path) ->
|
||||
case file:read_file(Path) of
|
||||
{ok, Bin} ->
|
||||
string:trim(Bin, trailing, "\n");
|
||||
_ ->
|
||||
%% this throws and makes Cuttlefish treak the key as invalid
|
||||
cuttlefish:invalid("file does not exist or cannot be read by the node")
|
||||
end
|
||||
end,
|
||||
SigningKeys =
|
||||
lists:map(fun(Key) ->
|
||||
{Id, Path} = Key,
|
||||
{list_to_binary(lists:last(Id)), TryReadingFileFun(Path)}
|
||||
end,
|
||||
Settings),
|
||||
maps:from_list(SigningKeys)
|
||||
end}.
|
||||
|
|
|
|||
Loading…
Reference in New Issue