Przeglądaj źródła

fix: RabbitMQ field not marked as required

This commit makes sure that the RabbitMQ password filed is marked as
required. This ensures that the user provides a password and that the
bridge does not throw a function clause exception if the password filed
is not set.

Fixes:
https://emqx.atlassian.net/browse/EMQX-9974
Kjell Winblad 2 lat temu
rodzic
commit
ea2fea77d7

+ 1 - 1
apps/emqx_bridge_rabbitmq/src/emqx_bridge_rabbitmq.app.src

@@ -1,6 +1,6 @@
 {application, emqx_bridge_rabbitmq, [
 {application, emqx_bridge_rabbitmq, [
     {description, "EMQX Enterprise RabbitMQ Bridge"},
     {description, "EMQX Enterprise RabbitMQ Bridge"},
-    {vsn, "0.1.0"},
+    {vsn, "0.1.1"},
     {registered, []},
     {registered, []},
     {applications, [kernel, stdlib, ecql, rabbit_common, amqp_client]},
     {applications, [kernel, stdlib, ecql, rabbit_common, amqp_client]},
     {env, []},
     {env, []},

+ 1 - 1
apps/emqx_bridge_rabbitmq/src/emqx_bridge_rabbitmq_connector.erl

@@ -72,7 +72,7 @@ fields(config) ->
                     desc => ?DESC("username")
                     desc => ?DESC("username")
                 }
                 }
             )},
             )},
-        {password, fun emqx_connector_schema_lib:password/1},
+        {password, fun emqx_connector_schema_lib:password_required/1},
         {pool_size,
         {pool_size,
             hoconsc:mk(
             hoconsc:mk(
                 typerefl:pos_integer(),
                 typerefl:pos_integer(),

+ 9 - 0
apps/emqx_connector/src/emqx_connector_schema_lib.erl

@@ -30,6 +30,7 @@
     database/1,
     database/1,
     username/1,
     username/1,
     password/1,
     password/1,
+    password_required/1,
     auto_reconnect/1
     auto_reconnect/1
 ]).
 ]).
 
 
@@ -104,6 +105,14 @@ password(sensitive) -> true;
 password(converter) -> fun emqx_schema:password_converter/2;
 password(converter) -> fun emqx_schema:password_converter/2;
 password(_) -> undefined.
 password(_) -> undefined.
 
 
+password_required(type) -> binary();
+password_required(desc) -> ?DESC("password");
+password_required(required) -> true;
+password_required(format) -> <<"password">>;
+password_required(sensitive) -> true;
+password_required(converter) -> fun emqx_schema:password_converter/2;
+password_required(_) -> undefined.
+
 auto_reconnect(type) -> boolean();
 auto_reconnect(type) -> boolean();
 auto_reconnect(desc) -> ?DESC("auto_reconnect");
 auto_reconnect(desc) -> ?DESC("auto_reconnect");
 auto_reconnect(default) -> true;
 auto_reconnect(default) -> true;