Просмотр исходного кода

fix(exproto): filter out ssl options if it disabled

JianBo He 4 лет назад
Родитель
Сommit
f90b27c291
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      apps/emqx_gateway/src/exproto/emqx_exproto_impl.erl

+ 8 - 4
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} ->