chore(connector http): update ssl for http connector

This commit is contained in:
zhanghongtong 2021-09-02 14:23:24 +08:00 committed by Rory Z
parent 516f2fd06e
commit b014266fa0
1 changed files with 6 additions and 9 deletions

View File

@ -58,9 +58,7 @@ fields(config) ->
, {pool_type, fun pool_type/1}
, {pool_size, fun pool_size/1}
, {enable_pipelining, fun enable_pipelining/1}
, {ssl_opts, #{type => hoconsc:ref(?MODULE, ssl_opts),
default => #{}}}
];
] ++ emqx_connector_schema_lib:ssl_fields();
fields(ssl_opts) ->
[ {cacertfile, fun cacertfile/1}
@ -200,12 +198,11 @@ check_ssl_opts(Conf) ->
check_ssl_opts(URLFrom, Conf) ->
#{schema := Scheme} = hocon_schema:get_value(URLFrom, Conf),
SSLOpts = hocon_schema:get_value("ssl_opts", Conf),
case {Scheme, maps:size(SSLOpts)} of
{http, 0} -> true;
{http, _} -> false;
{https, 0} -> false;
{https, _} -> true
SSL= hocon_schema:get_value("ssl", Conf),
case {Scheme, maps:get(enable, SSL, false)} of
{http, false} -> true;
{https, true} -> true;
{_, _} -> false
end.
update_path(BasePath, {Path, Headers}) ->