From f90b27c291e8a50a575acf1c6f1ca8d4d099ac1d Mon Sep 17 00:00:00 2001 From: JianBo He Date: Wed, 9 Mar 2022 14:27:03 +0800 Subject: [PATCH] fix(exproto): filter out ssl options if it disabled --- apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl b/apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl index ff52c2295..fac55e24d 100644 --- a/apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl +++ b/apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl @@ -127,10 +127,14 @@ start_grpc_server(GwName, Options = #{bind := ListenOn}) -> services => #{ 'emqx.exproto.v1.ConnectionAdapter' => emqx_exproto_gsvr} }, - SvrOptions = case maps:to_list(maps:get(ssl, Options, #{})) of - [] -> []; - SslOpts -> - [{ssl_options, SslOpts}] + SvrOptions = case emqx_map_lib:deep_get([ssl, enable], Options, false) of + false -> []; + true -> + [{ssl_options, + maps:to_list( + maps:without([enable], maps:get(ssl, Options, #{})) + ) + }] end, case grpc:start_server(GwName, ListenOn, Services, SvrOptions) of {ok, _SvrPid} ->