Jelajahi Sumber

chore(connector http): update ssl for http connector

zhanghongtong 4 tahun lalu
induk
melakukan
b014266fa0
1 mengubah file dengan 6 tambahan dan 9 penghapusan
  1. 6 9
      apps/emqx_connector/src/emqx_connector_http.erl

+ 6 - 9
apps/emqx_connector/src/emqx_connector_http.erl

@@ -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}) ->