refactor(emqx_machine_schema): use hoconsc:map type

This commit is contained in:
Zaiming Shi 2021-09-04 08:07:11 +02:00
parent bbd1c142de
commit 0039bfca6b
2 changed files with 8 additions and 9 deletions

View File

@ -78,8 +78,11 @@ namespace() -> undefined.
roots() -> roots() ->
[{"zones", [{"zones",
sc(map("name", ref("zone")), sc(map("name", ref("zone")),
#{ desc => "A zones is a set configs grouped per the zone's name, there is a builtin zone named 'default' " #{ desc => "A zone is a set of configs grouped by the zone `$name`. <br>"
"The name of a zone can be bound to listners to apply zone settings to connections accepted by the bound listener." "The `$name` can be set to a listner's `zone` config for "
"flexible configuration mapping. <br>"
"NOTE: A builtin zone named `default` is auto created "
"and can not be deleted."
})}, })},
"mqtt", "mqtt",
"flapping_detect", "flapping_detect",

View File

@ -381,7 +381,7 @@ fields("rpc") ->
fields("log") -> fields("log") ->
[ {"console_handler", ref("console_handler")} [ {"console_handler", ref("console_handler")}
, {"file_handlers", , {"file_handlers",
sc(ref("file_handlers"), sc(map(name, ref("log_file_handler")),
#{})} #{})}
, {"error_logger", , {"error_logger",
sc(atom(), sc(atom(),
@ -396,12 +396,6 @@ fields("console_handler") ->
})} })}
] ++ log_handler_common_confs(); ] ++ log_handler_common_confs();
fields("file_handlers") ->
[ {"$name",
sc(ref("log_file_handler"),
#{})}
];
fields("log_file_handler") -> fields("log_file_handler") ->
[ {"file", [ {"file",
sc(file(), sc(file(),
@ -701,6 +695,8 @@ keys(Parent, Conf) ->
sc(Type, Meta) -> hoconsc:mk(Type, Meta). sc(Type, Meta) -> hoconsc:mk(Type, Meta).
map(Name, Type) -> hoconsc:map(Name, Type).
ref(Field) -> hoconsc:ref(?MODULE, Field). ref(Field) -> hoconsc:ref(?MODULE, Field).
options(static, Conf) -> options(static, Conf) ->