chore(formatting): Fix formatting of modules, authz and authn

This commit is contained in:
ieQu1 2022-04-05 10:42:25 +02:00
parent 43aa2ea481
commit 8df76da9ac
5 changed files with 72 additions and 53 deletions

View File

@ -1294,7 +1294,8 @@ fields("broker_perf") ->
"Change this parameter only when there are many wildcard topics.<br/>\n"
"NOTE: when changing from/to `global` lock, it requires all\n"
"nodes in the cluster to be stopped before the change.\n\n"
" - `key`: mnesia transactional updates with per-key locks. Recommended for a single-node setup.\n"
" - `key`: mnesia transactional updates with per-key locks. "
"Recommended for a single-node setup.\n"
" - `tab`: mnesia transactional updates with table lock. Recommended for a cluster setup.\n"
" - `global`: updates are protected with a global lock. Recommended for large clusters."
}

View File

@ -78,7 +78,8 @@ common_fields() ->
{mechanism, emqx_authn_schema:mechanism('password_based')},
{backend, emqx_authn_schema:backend(http)},
{url, fun url/1},
{body, hoconsc:mk(map([{fuzzy, term(), binary()}]), #{desc => "Body of the HTTP request."})},
{body,
hoconsc:mk(map([{fuzzy, term(), binary()}]), #{desc => "Body of the HTTP request."})},
{request_timeout, fun request_timeout/1}
] ++ emqx_authn_schema:common_fields() ++
maps:to_list(

View File

@ -27,11 +27,12 @@
-type action() :: publish | subscribe | all.
-type permission() :: allow | deny.
-export([ namespace/0
, roots/0
, fields/1
, validations/0
, desc/1
-export([
namespace/0,
roots/0,
fields/1,
validations/0,
desc/1
]).
-export([
@ -94,35 +95,42 @@ fields("authorization") ->
}}
];
fields(file) ->
[ {type, #{type => file, desc => "Backend type."}}
, {enable, #{type => boolean(),
[
{type, #{type => file, desc => "Backend type."}},
{enable, #{
type => boolean(),
default => true,
desc => "Enable this backend."
}}
, {path, #{type => string(),
}},
{path, #{
type => string(),
required => true,
desc => "
Path to the file which contains the ACL rules.<br>
If the file provisioned before starting EMQX node,
it can be placed anywhere as long as EMQX has read access to it.
In case the rule-set is created from EMQX dashboard or management API,
the file will be placed in `authz` subdirectory inside EMQX's `data_dir`,
and the new rules will override all rules from the old config file.
"
desc =>
"\n"
"Path to the file which contains the ACL rules.<br>\n"
"If the file provisioned before starting EMQX node,\n"
"it can be placed anywhere as long as EMQX has read access to it.\n"
"\n"
"In case the rule-set is created from EMQX dashboard or management API,\n"
"the file will be placed in `authz` subdirectory inside EMQX's `data_dir`,\n"
"and the new rules will override all rules from the old config file.\n"
}}
];
fields(http_get) ->
[ {method, #{type => get, default => get, desc => "HTTP method."}}
, {headers, fun headers_no_content_type/1}
[
{method, #{type => get, default => get, desc => "HTTP method."}},
{headers, fun headers_no_content_type/1}
] ++ http_common_fields();
fields(http_post) ->
[ {method, #{type => post, default => post, desc => "HTTP method."}}
, {headers, fun headers/1}
[
{method, #{type => post, default => post, desc => "HTTP method."}},
{headers, fun headers/1}
] ++ http_common_fields();
fields(mnesia) ->
[ {type, #{type => 'built_in_database', desc => "Backend type."}}
, {enable, #{type => boolean(),
[
{type, #{type => 'built_in_database', desc => "Backend type."}},
{enable, #{
type => boolean(),
default => true,
desc => "Enable this backend."
}}
@ -137,11 +145,14 @@ fields(mysql) ->
connector_fields(mysql) ++
[{query, query()}];
fields(postgresql) ->
[ {query, query()}
, {type, #{type => postgresql, desc => "Backend type."}}
, {enable, #{type => boolean(),
[
{query, query()},
{type, #{type => postgresql, desc => "Backend type."}},
{enable, #{
type => boolean(),
desc => "Enable this backend.",
default => true}}
default => true
}}
] ++ emqx_connector_pgsql:fields(config);
fields(redis_single) ->
connector_fields(redis, single) ++
@ -321,7 +332,8 @@ union_array(Item) when is_list(Item) ->
hoconsc:array(hoconsc:union(Item)).
query() ->
#{type => binary(),
#{
type => binary(),
desc => "Database query used to retrieve authorization data.",
validator => fun(S) ->
case size(S) > 0 of

View File

@ -42,7 +42,8 @@ fields("telemetry") ->
fields("delayed") ->
[
{enable, hoconsc:mk(boolean(), #{default => false, desc => "Enable `delayed` module."})},
{max_delayed_messages, sc(integer(), #{desc => "Maximum number of delayed messages (0 is no limit)."})}
{max_delayed_messages,
sc(integer(), #{desc => "Maximum number of delayed messages (0 is no limit)."})}
];
fields("rewrite") ->
[

View File

@ -26,7 +26,8 @@ fields("retainer") ->
, {stop_publish_clear_msg, sc(boolean(),
"When the retained flag of the `PUBLISH` message is set and Payload is empty, "
"whether to continue to publish the message.<br/>"
"See: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718038",
"See: "
"http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718038",
false)}
, {backend, backend_config()}
];
@ -52,9 +53,12 @@ fields(flow_control) ->
0)}
, {batch_deliver_limiter, sc(emqx_limiter_schema:bucket_name(),
"The rate limiter name for retained messages' delivery.<br/>"
"Limiter helps to avoid delivering too many messages to the client at once, which may cause the client "
"to block or crash, or drop messages due to exceeding the size of the message queue.<br/>"
"The names of the available rate limiters are taken from the existing rate limiters under `limiter.batch`.<br/>"
"Limiter helps to avoid delivering too many messages to the client at once, "
"which may cause the client "
"to block or crash, or drop messages due to exceeding the size of the message"
" queue.<br/>"
"The names of the available rate limiters are taken from the existing rate "
"limiters under `limiter.batch`.<br/>"
"If this field is empty, limiter is not used.",
undefined)}
].