fix(exproto): ssl options for grpc client

This commit is contained in:
Zaiming (Stone) Shi 2023-12-14 16:51:58 +01:00
parent 406a2d7a52
commit d29d3f36f1
1 changed files with 4 additions and 4 deletions

View File

@ -200,18 +200,18 @@ start_grpc_client_channel(
}} }}
) )
end, end,
case emqx_utils_maps:deep_get([ssl_options, enable], Options, false) of SSLOpts = emqx_utils_maps:deep_get([ssl_options], Options, #{}),
case maps:get(enable, SSLOpts, false) of
false -> 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, #{});
true -> true ->
Opts1 = maps:get(ssl, Options, #{}), SSLOpts1 = [{nodelay, true} | emqx_tls_lib:to_client_opts(SSLOpts)],
SslOpts = [{nodelay, true} | emqx_tls_lib:to_client_opts(Opts1)],
ClientOpts = #{ ClientOpts = #{
gun_opts => gun_opts =>
#{ #{
transport => ssl, transport => ssl,
transport_opts => SslOpts transport_opts => SSLOpts1
} }
}, },
SvrAddr = compose_http_uri(https, Host, Port), SvrAddr = compose_http_uri(https, Host, Port),