From 5785b0c20b2f4b841c1b81fad86b614e3d39fe46 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 13 Dec 2021 15:39:59 +0800 Subject: [PATCH] fix(ssl): file content return type --- apps/emqx/src/emqx_tls_lib.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/emqx/src/emqx_tls_lib.erl b/apps/emqx/src/emqx_tls_lib.erl index 0d64f3003..ec339a968 100644 --- a/apps/emqx/src/emqx_tls_lib.erl +++ b/apps/emqx/src/emqx_tls_lib.erl @@ -353,11 +353,12 @@ is_valid_pem_file(Path) -> %% @doc This is to return SSL file content in management APIs. file_content_as_options(undefined) -> undefined; 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(?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) -> case maps:get(Key, SSL, undefined) of undefined -> file_content_as_options(Keys, SSL);