diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index f9ee7e7e0..e9a4385c7 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -69,56 +69,82 @@
cipher/0,
comma_separated_atoms/0]).
--export([namespace/0, roots/0, fields/1]).
+-export([namespace/0, roots/0, roots/1, fields/1]).
-export([conf_get/2, conf_get/3, keys/2, filter/1]).
-export([ssl/1]).
namespace() -> undefined.
roots() ->
+ %% TODO change config importance to a field metadata
+ roots(high) ++ roots(medium) ++ roots(low).
+
+roots(high) ->
[ {"listeners",
sc(ref("listeners"),
#{ desc => "MQTT listeners identified by their protocol type and assigned names"
})
- },
- {"zones",
- sc(map("name", ref("zone")),
- #{ desc => "A zone is a set of configs grouped by the zone name
.
"
- "For flexible configuration mapping, the name
"
- "can be set to a listener's zone
config .
"
- "NOTE: A builtin zone named default
is auto created "
- "and can not be deleted."
- })},
- {"mqtt",
- sc(ref("mqtt"),
+ }
+ , {"zones",
+ sc(map("name", ref("zone")),
+ #{ desc => "A zone is a set of configs grouped by the zone name
.
"
+ "For flexible configuration mapping, the name
"
+ "can be set to a listener's zone
config .
"
+ "NOTE: A builtin zone named default
is auto created "
+ "and can not be deleted."
+ })}
+ , {"mqtt",
+ sc(ref("mqtt"),
#{ desc => "Global MQTT configuration.
"
"The configs here work as default values which can be overriden "
"in zone
configs"
- })},
- "rate_limit",
- "force_shutdown",
- "force_gc",
- "conn_congestion",
- "quota",
- "broker",
- "plugins", %% TODO: move to emqx_machine_schema
- "stats",
- "sysmon",
- "alarm",
- {"authentication",
+ })}
+ , {"authentication",
sc(hoconsc:lazy(hoconsc:array(map())),
#{ desc => "Default authentication configs for all MQTT listeners.
"
"For per-listener overrides see authentication
"
"in listener configs"
- })},
- {"authentication",
- sc(hoconsc:lazy(hoconsc:array(map())),
- #{ desc => "Default authentication configs for all MQTT listeners.
"
- "For per-listener overrides see authentication
"
- "in listener configs"
- })},
- "authorization",
- "flapping_detect"
+ })}
+ , {"authorization",
+ sc(ref("authorization"),
+ #{})}
+ ];
+roots(medium) ->
+ [ {"broker",
+ sc(ref("broker"),
+ #{})}
+ , {"rate_limit",
+ sc(ref("rate_limit"),
+ #{})}
+ , {"force_shutdown",
+ sc(ref("force_shutdown"),
+ #{})}
+ ];
+roots(low) ->
+ [ {"force_gc",
+ sc(ref("force_gc"),
+ #{})}
+ , {"conn_congestion",
+ sc(ref("conn_congestion"),
+ #{})}
+ , {"quota",
+ sc(ref("quota"),
+ #{})}
+ , {"plugins", %% TODO: move to emqx_machine_schema
+ sc(ref("plugins"),
+ #{})}
+ , {"stats",
+ sc(ref("stats"),
+ #{})}
+ , {"sysmon",
+ sc(ref("sysmon"),
+ #{})}
+ , {"alarm",
+ sc(ref("alarm"),
+ #{})}
+ , {"flapping_detect",
+ sc(ref("flapping_detect"),
+ #{})}
].
fields("stats") ->
@@ -140,8 +166,7 @@ fields("authorization") ->
, {"cache",
sc(ref(?MODULE, "cache"),
#{
- })
- }
+ })}
];
fields("cache") ->
diff --git a/apps/emqx_machine/src/emqx_machine_schema.erl b/apps/emqx_machine/src/emqx_machine_schema.erl
index 5ef9df7c6..e4f7a8d1a 100644
--- a/apps/emqx_machine/src/emqx_machine_schema.erl
+++ b/apps/emqx_machine/src/emqx_machine_schema.erl
@@ -42,8 +42,7 @@
%% The list can not be made a dynamic read at run-time as it is used
%% by nodetool to generate app.