fix(authz api): fix error for read cert file

This commit is contained in:
zhanghongtong 2021-10-11 15:24:56 +08:00 committed by Rory Z
parent c90342da4a
commit 585c4892ce
1 changed files with 7 additions and 7 deletions

View File

@ -428,22 +428,22 @@ update_config(Cmd, Sources) ->
end. end.
read_cert(#{<<"ssl">> := #{<<"enable">> := true} = SSL} = Source) -> read_cert(#{<<"ssl">> := #{<<"enable">> := true} = SSL} = Source) ->
CaCert = case file:read_file(maps:get(cacertfile, SSL, "")) of CaCert = case file:read_file(maps:get(<<"cacertfile">>, SSL, "")) of
{ok, CaCert0} -> CaCert0; {ok, CaCert0} -> CaCert0;
_ -> "" _ -> ""
end, end,
Cert = case file:read_file(maps:get(certfile, SSL, "")) of Cert = case file:read_file(maps:get(<<"certfile">>, SSL, "")) of
{ok, Cert0} -> Cert0; {ok, Cert0} -> Cert0;
_ -> "" _ -> ""
end, end,
Key = case file:read_file(maps:get(keyfile, SSL, "")) of Key = case file:read_file(maps:get(<<"keyfile">>, SSL, "")) of
{ok, Key0} -> Key0; {ok, Key0} -> Key0;
_ -> "" _ -> ""
end, end,
Source#{ssl => SSL#{cacertfile => CaCert, Source#{<<"ssl">> => SSL#{<<"cacertfile">> => CaCert,
certfile => Cert, <<"certfile">> => Cert,
keyfile => Key <<"keyfile">> => Key
} }
}; };
read_cert(Source) -> Source. read_cert(Source) -> Source.