refactor: make all bridges optional (required = false)

This commit is contained in:
Zaiming (Stone) Shi 2022-11-30 23:19:35 +01:00
parent 7adb539ae1
commit 9ea22d062d
3 changed files with 27 additions and 6 deletions

View File

@ -14,6 +14,8 @@
%% limitations under the License. %% limitations under the License.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% @doc This module was created to convert old version (from v5.0.0 to v5.0.11)
%% mqtt connector configs to newer version (developed for enterprise edition).
-module(emqx_bridge_mqtt_config). -module(emqx_bridge_mqtt_config).
-export([ -export([

View File

@ -96,13 +96,17 @@ fields(bridges) ->
{webhook, {webhook,
mk( mk(
hoconsc:map(name, ref(emqx_bridge_webhook_schema, "config")), hoconsc:map(name, ref(emqx_bridge_webhook_schema, "config")),
#{desc => ?DESC("bridges_webhook")} #{
desc => ?DESC("bridges_webhook"),
required => false
}
)}, )},
{mqtt, {mqtt,
mk( mk(
hoconsc:map(name, ref(emqx_bridge_mqtt_schema, "config")), hoconsc:map(name, ref(emqx_bridge_mqtt_schema, "config")),
#{ #{
desc => ?DESC("bridges_mqtt"), desc => ?DESC("bridges_mqtt"),
required => false,
converter => fun emqx_bridge_mqtt_config:upgrade_pre_ee/1 converter => fun emqx_bridge_mqtt_config:upgrade_pre_ee/1
} }
)} )}

View File

@ -62,17 +62,26 @@ fields(bridges) ->
{kafka, {kafka,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_kafka, "config")), hoconsc:map(name, ref(emqx_ee_bridge_kafka, "config")),
#{desc => <<"EMQX Enterprise Config">>} #{
desc => <<"Kafka Bridge Config">>,
required => false
}
)}, )},
{hstreamdb, {hstreamdb,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_hstreamdb, "config")), hoconsc:map(name, ref(emqx_ee_bridge_hstreamdb, "config")),
#{desc => <<"EMQX Enterprise Config">>} #{
desc => <<"HStreamDB Bridge Config">>,
required => false
}
)}, )},
{mysql, {mysql,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_mysql, "config")), hoconsc:map(name, ref(emqx_ee_bridge_mysql, "config")),
#{desc => <<"EMQX Enterprise Config">>} #{
desc => <<"MySQL Bridge Config">>,
required => false
}
)} )}
] ++ mongodb_structs() ++ influxdb_structs(). ] ++ mongodb_structs() ++ influxdb_structs().
@ -81,7 +90,10 @@ mongodb_structs() ->
{Type, {Type,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_mongodb, Type)), hoconsc:map(name, ref(emqx_ee_bridge_mongodb, Type)),
#{desc => <<"EMQX Enterprise Config">>} #{
desc => <<"MongoDB Bridge Config">>,
required => false
}
)} )}
|| Type <- [mongodb_rs, mongodb_sharded, mongodb_single] || Type <- [mongodb_rs, mongodb_sharded, mongodb_single]
]. ].
@ -91,7 +103,10 @@ influxdb_structs() ->
{Protocol, {Protocol,
mk( mk(
hoconsc:map(name, ref(emqx_ee_bridge_influxdb, Protocol)), hoconsc:map(name, ref(emqx_ee_bridge_influxdb, Protocol)),
#{desc => <<"EMQX Enterprise Config">>} #{
desc => <<"InfluxDB Bridge Config">>,
required => false
}
)} )}
|| Protocol <- [ || Protocol <- [
%% influxdb_udp, %% influxdb_udp,