fix(ssl): file content return type

This commit is contained in:
JimMoen 2021-12-13 15:39:59 +08:00
parent e5b11d48a2
commit 5785b0c20b
1 changed files with 3 additions and 2 deletions

View File

@ -353,11 +353,12 @@ is_valid_pem_file(Path) ->
%% @doc This is to return SSL file content in management APIs. %% @doc This is to return SSL file content in management APIs.
file_content_as_options(undefined) -> undefined; file_content_as_options(undefined) -> undefined;
file_content_as_options(#{<<"enable">> := false} = SSL) -> file_content_as_options(#{<<"enable">> := false} = SSL) ->
maps:without(?SSL_FILE_OPT_NAMES, SSL); {ok, maps:without(?SSL_FILE_OPT_NAMES, SSL)};
file_content_as_options(#{<<"enable">> := true} = SSL) -> file_content_as_options(#{<<"enable">> := true} = SSL) ->
file_content_as_options(?SSL_FILE_OPT_NAMES, SSL). file_content_as_options(?SSL_FILE_OPT_NAMES, SSL).
file_content_as_options([], SSL) -> {ok, SSL}; file_content_as_options([], SSL) ->
{ok, SSL};
file_content_as_options([Key | Keys], SSL) -> file_content_as_options([Key | Keys], SSL) ->
case maps:get(Key, SSL, undefined) of case maps:get(Key, SSL, undefined) of
undefined -> file_content_as_options(Keys, SSL); undefined -> file_content_as_options(Keys, SSL);