|
|
@@ -6,10 +6,11 @@
|
|
|
|
|
|
-behaviour(hocon_schema).
|
|
|
|
|
|
--export([namespace/0, roots/0, fields/1, translations/0, translation/1]).
|
|
|
+-export([namespace/0, roots/0, fields/1, translations/0, translation/1, desc/1]).
|
|
|
|
|
|
-define(EE_SCHEMA_MODULES, [
|
|
|
emqx_license_schema,
|
|
|
+ emqx_s3_schema,
|
|
|
emqx_ft_schema
|
|
|
]).
|
|
|
|
|
|
@@ -17,16 +18,10 @@ namespace() ->
|
|
|
emqx_conf_schema:namespace().
|
|
|
|
|
|
roots() ->
|
|
|
- lists:foldl(
|
|
|
- fun(Module, Roots) ->
|
|
|
- Roots ++ apply(Module, roots, [])
|
|
|
- end,
|
|
|
- emqx_conf_schema:roots(),
|
|
|
- ?EE_SCHEMA_MODULES
|
|
|
- ).
|
|
|
+ emqx_conf_schema:roots() ++ ee_roots().
|
|
|
|
|
|
fields(Name) ->
|
|
|
- ee_fields(?EE_SCHEMA_MODULES, Name).
|
|
|
+ ee_delegate(fields, ?EE_SCHEMA_MODULES, Name).
|
|
|
|
|
|
translations() ->
|
|
|
emqx_conf_schema:translations().
|
|
|
@@ -34,16 +29,27 @@ translations() ->
|
|
|
translation(Name) ->
|
|
|
emqx_conf_schema:translation(Name).
|
|
|
|
|
|
+desc(Name) ->
|
|
|
+ ee_delegate(desc, ?EE_SCHEMA_MODULES, Name).
|
|
|
+
|
|
|
%%------------------------------------------------------------------------------
|
|
|
%% helpers
|
|
|
%%------------------------------------------------------------------------------
|
|
|
|
|
|
-ee_fields([EEMod | EEMods], Name) ->
|
|
|
+ee_roots() ->
|
|
|
+ lists:flatmap(
|
|
|
+ fun(Module) ->
|
|
|
+ apply(Module, roots, [])
|
|
|
+ end,
|
|
|
+ ?EE_SCHEMA_MODULES
|
|
|
+ ).
|
|
|
+
|
|
|
+ee_delegate(Method, [EEMod | EEMods], Name) ->
|
|
|
case lists:member(Name, apply(EEMod, roots, [])) of
|
|
|
true ->
|
|
|
- apply(EEMod, fields, [Name]);
|
|
|
+ EEMod:Method(Name);
|
|
|
false ->
|
|
|
- ee_fields(EEMods, Name)
|
|
|
+ ee_delegate(Method, EEMods, Name)
|
|
|
end;
|
|
|
-ee_fields([], Name) ->
|
|
|
- emqx_conf_schema:fields(Name).
|
|
|
+ee_delegate(Method, [], Name) ->
|
|
|
+ emqx_conf_schema:Method(Name).
|