refactor: remove BridgeName from connector_config callback
As `bridge_name` is already in the Config parameter, this callback doesn't need to have it on API anymore. Fixes https://github.com/emqx/emqx/pull/11546/files#r1310778734
This commit is contained in:
parent
727fd296ee
commit
7b607c3300
|
@ -49,11 +49,8 @@
|
||||||
update/4
|
update/4
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-callback connector_config(ParsedConfig, BridgeName :: atom() | binary()) ->
|
-callback connector_config(ParsedConfig) -> ParsedConfig when ParsedConfig :: #{atom() => any()}.
|
||||||
ParsedConfig
|
-optional_callbacks([connector_config/1]).
|
||||||
when
|
|
||||||
ParsedConfig :: #{atom() => any()}.
|
|
||||||
-optional_callbacks([connector_config/2]).
|
|
||||||
|
|
||||||
%% bi-directional bridge with producer/consumer or ingress/egress configs
|
%% bi-directional bridge with producer/consumer or ingress/egress configs
|
||||||
-define(IS_BI_DIR_BRIDGE(TYPE),
|
-define(IS_BI_DIR_BRIDGE(TYPE),
|
||||||
|
@ -391,14 +388,14 @@ parse_confs(Type, Name, Conf) when ?IS_INGRESS_BRIDGE(Type) ->
|
||||||
BId = bridge_id(Type, Name),
|
BId = bridge_id(Type, Name),
|
||||||
BridgeHookpoint = bridge_hookpoint(BId),
|
BridgeHookpoint = bridge_hookpoint(BId),
|
||||||
Conf#{hookpoint => BridgeHookpoint};
|
Conf#{hookpoint => BridgeHookpoint};
|
||||||
parse_confs(BridgeType, BridgeName, Config) ->
|
parse_confs(BridgeType, _BridgeName, Config) ->
|
||||||
connector_config(BridgeType, BridgeName, Config).
|
connector_config(BridgeType, Config).
|
||||||
|
|
||||||
connector_config(BridgeType, BridgeName, Config) ->
|
connector_config(BridgeType, Config) ->
|
||||||
Mod = bridge_impl_module(BridgeType),
|
Mod = bridge_impl_module(BridgeType),
|
||||||
case erlang:function_exported(Mod, connector_config, 2) of
|
case erlang:function_exported(Mod, connector_config, 1) of
|
||||||
true ->
|
true ->
|
||||||
Mod:connector_config(Config, BridgeName);
|
Mod:connector_config(Config);
|
||||||
false ->
|
false ->
|
||||||
Config
|
Config
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
%% emqx_bridge_enterprise "unofficial" API
|
%% emqx_bridge_enterprise "unofficial" API
|
||||||
-export([conn_bridge_examples/1]).
|
-export([conn_bridge_examples/1]).
|
||||||
|
|
||||||
-export([connector_config/2]).
|
-export([connector_config/1]).
|
||||||
|
|
||||||
-export([producer_converter/2, host_opts/0]).
|
-export([producer_converter/2, host_opts/0]).
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ values(producer) ->
|
||||||
%% `emqx_bridge_resource' API
|
%% `emqx_bridge_resource' API
|
||||||
%%-------------------------------------------------------------------------------------------------
|
%%-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
connector_config(Config, _BridgeName) ->
|
connector_config(Config) ->
|
||||||
%% Default port for AEH is 9093
|
%% Default port for AEH is 9093
|
||||||
BootstrapHosts0 = maps:get(bootstrap_hosts, Config),
|
BootstrapHosts0 = maps:get(bootstrap_hosts, Config),
|
||||||
BootstrapHosts = emqx_schema:parse_servers(
|
BootstrapHosts = emqx_schema:parse_servers(
|
||||||
|
|
Loading…
Reference in New Issue