fix(exproto): don't carry the ssl confs if ssl.enable is false

This commit is contained in:
JianBo He 2022-03-21 18:44:01 +08:00
parent 670749493b
commit 094c4ad262
1 changed files with 5 additions and 3 deletions

View File

@ -166,14 +166,16 @@ start_grpc_client_channel(GwName, Options = #{address := Address}) ->
}}) }})
end, end,
case maps:to_list(maps:get(ssl, Options, #{})) of case emqx_map_lib:deep_get([ssl, enable], Options, false) of
[] -> false ->
SvrAddr = compose_http_uri(http, Host, Port), SvrAddr = compose_http_uri(http, Host, Port),
grpc_client_sup:create_channel_pool(GwName, SvrAddr, #{}); grpc_client_sup:create_channel_pool(GwName, SvrAddr, #{});
SslOpts -> true ->
SslOpts = maps:to_list(maps:get(ssl, Options, #{})),
ClientOpts = #{gun_opts => ClientOpts = #{gun_opts =>
#{transport => ssl, #{transport => ssl,
transport_opts => SslOpts}}, transport_opts => SslOpts}},
SvrAddr = compose_http_uri(https, Host, Port), SvrAddr = compose_http_uri(https, Host, Port),
grpc_client_sup:create_channel_pool(GwName, SvrAddr, ClientOpts) grpc_client_sup:create_channel_pool(GwName, SvrAddr, ClientOpts)
end. end.