feat: support array bridge_mqtt conf
This commit is contained in:
parent
78cf115a90
commit
e4f5e9332e
|
@ -15,7 +15,7 @@
|
|||
, {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.8.2"}}}
|
||||
, {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.10.8"}}}
|
||||
, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.11.1"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.12.1"}}}
|
||||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
||||
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
|
||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.14.1"}}}
|
||||
|
|
|
@ -299,7 +299,7 @@ save_schema_mod_and_names(SchemaMod) ->
|
|||
RootNames = SchemaMod:structs(),
|
||||
OldMods = get_schema_mod(),
|
||||
OldNames = get_root_names(),
|
||||
NewMods = maps:from_list([{bin(Name), SchemaMod} || Name <- RootNames]),
|
||||
NewMods = maps:from_list([{root_bin(Name), SchemaMod} || Name <- RootNames]),
|
||||
persistent_term:put(?PERSIS_SCHEMA_MODS, #{
|
||||
mods => maps:merge(OldMods, NewMods),
|
||||
names => lists:usort(OldNames ++ RootNames)
|
||||
|
@ -440,3 +440,6 @@ conf_key(?CONF, RootName) ->
|
|||
atom(RootName);
|
||||
conf_key(?RAW_CONF, RootName) ->
|
||||
bin(RootName).
|
||||
|
||||
root_bin({array, Bin}) -> bin(Bin);
|
||||
root_bin(Bin) -> bin(Bin).
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
## Configuration for EMQ X MQTT Broker Bridge
|
||||
##====================================================================
|
||||
|
||||
emqx_bridge_mqtt {
|
||||
bridges:[
|
||||
bridge_mqtt: [
|
||||
# {
|
||||
# name: "mqtt1"
|
||||
# start_type: auto
|
||||
|
@ -55,4 +54,3 @@ emqx_bridge_mqtt {
|
|||
# }
|
||||
# }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -23,13 +23,9 @@
|
|||
-export([ structs/0
|
||||
, fields/1]).
|
||||
|
||||
structs() -> ["emqx_bridge_mqtt"].
|
||||
structs() -> [{array, "bridge_mqtt"}].
|
||||
|
||||
fields("emqx_bridge_mqtt") ->
|
||||
[ {bridges, hoconsc:array(hoconsc:ref(?MODULE, "bridges"))}
|
||||
];
|
||||
|
||||
fields("bridges") ->
|
||||
fields("bridge_mqtt") ->
|
||||
[ {name, emqx_schema:t(string(), undefined, true)}
|
||||
, {start_type, fun start_type/1}
|
||||
, {forwards, fun forwards/1}
|
||||
|
|
|
@ -204,7 +204,8 @@ fields(Name) ->
|
|||
find_field(Name, []) ->
|
||||
error({unknown_config_struct_field, Name});
|
||||
find_field(Name, [SchemaModule | Rest]) ->
|
||||
case lists:member(Name, SchemaModule:structs()) of
|
||||
case lists:member(Name, SchemaModule:structs()) orelse
|
||||
lists:keymember(Name, 2, SchemaModule:structs()) of
|
||||
true -> SchemaModule:fields(Name);
|
||||
false -> find_field(Name, Rest)
|
||||
end.
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
|
||||
, {getopt, "1.0.2"}
|
||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.14.1"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.11.1"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.12.1"}}}
|
||||
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.4.0"}}}
|
||||
, {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
|
||||
]}.
|
||||
|
|
Loading…
Reference in New Issue