chore(formatting): Fix formatting of modules, authz and authn
This commit is contained in:
parent
43aa2ea481
commit
8df76da9ac
|
@ -1294,7 +1294,8 @@ fields("broker_perf") ->
|
||||||
"Change this parameter only when there are many wildcard topics.<br/>\n"
|
"Change this parameter only when there are many wildcard topics.<br/>\n"
|
||||||
"NOTE: when changing from/to `global` lock, it requires all\n"
|
"NOTE: when changing from/to `global` lock, it requires all\n"
|
||||||
"nodes in the cluster to be stopped before the change.\n\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"
|
" - `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."
|
" - `global`: updates are protected with a global lock. Recommended for large clusters."
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,8 @@ common_fields() ->
|
||||||
{mechanism, emqx_authn_schema:mechanism('password_based')},
|
{mechanism, emqx_authn_schema:mechanism('password_based')},
|
||||||
{backend, emqx_authn_schema:backend(http)},
|
{backend, emqx_authn_schema:backend(http)},
|
||||||
{url, fun url/1},
|
{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}
|
{request_timeout, fun request_timeout/1}
|
||||||
] ++ emqx_authn_schema:common_fields() ++
|
] ++ emqx_authn_schema:common_fields() ++
|
||||||
maps:to_list(
|
maps:to_list(
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
-type action() :: publish | subscribe | all.
|
-type action() :: publish | subscribe | all.
|
||||||
-type permission() :: allow | deny.
|
-type permission() :: allow | deny.
|
||||||
|
|
||||||
-export([ namespace/0
|
-export([
|
||||||
, roots/0
|
namespace/0,
|
||||||
, fields/1
|
roots/0,
|
||||||
, validations/0
|
fields/1,
|
||||||
, desc/1
|
validations/0,
|
||||||
]).
|
desc/1
|
||||||
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
headers_no_content_type/1,
|
headers_no_content_type/1,
|
||||||
|
@ -94,38 +95,45 @@ fields("authorization") ->
|
||||||
}}
|
}}
|
||||||
];
|
];
|
||||||
fields(file) ->
|
fields(file) ->
|
||||||
[ {type, #{type => file, desc => "Backend type."}}
|
[
|
||||||
, {enable, #{type => boolean(),
|
{type, #{type => file, desc => "Backend type."}},
|
||||||
default => true,
|
{enable, #{
|
||||||
desc => "Enable this backend."
|
type => boolean(),
|
||||||
}}
|
default => true,
|
||||||
, {path, #{type => string(),
|
desc => "Enable this backend."
|
||||||
required => true,
|
}},
|
||||||
desc => "
|
{path, #{
|
||||||
Path to the file which contains the ACL rules.<br>
|
type => string(),
|
||||||
If the file provisioned before starting EMQX node,
|
required => true,
|
||||||
it can be placed anywhere as long as EMQX has read access to it.
|
desc =>
|
||||||
|
"\n"
|
||||||
In case the rule-set is created from EMQX dashboard or management API,
|
"Path to the file which contains the ACL rules.<br>\n"
|
||||||
the file will be placed in `authz` subdirectory inside EMQX's `data_dir`,
|
"If the file provisioned before starting EMQX node,\n"
|
||||||
and the new rules will override all rules from the old config file.
|
"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) ->
|
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();
|
] ++ http_common_fields();
|
||||||
fields(http_post) ->
|
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();
|
] ++ http_common_fields();
|
||||||
fields(mnesia) ->
|
fields(mnesia) ->
|
||||||
[ {type, #{type => 'built_in_database', desc => "Backend type."}}
|
[
|
||||||
, {enable, #{type => boolean(),
|
{type, #{type => 'built_in_database', desc => "Backend type."}},
|
||||||
default => true,
|
{enable, #{
|
||||||
desc => "Enable this backend."
|
type => boolean(),
|
||||||
}}
|
default => true,
|
||||||
|
desc => "Enable this backend."
|
||||||
|
}}
|
||||||
];
|
];
|
||||||
fields(mongo_single) ->
|
fields(mongo_single) ->
|
||||||
mongo_common_fields() ++ emqx_connector_mongo:fields(single);
|
mongo_common_fields() ++ emqx_connector_mongo:fields(single);
|
||||||
|
@ -137,11 +145,14 @@ fields(mysql) ->
|
||||||
connector_fields(mysql) ++
|
connector_fields(mysql) ++
|
||||||
[{query, query()}];
|
[{query, query()}];
|
||||||
fields(postgresql) ->
|
fields(postgresql) ->
|
||||||
[ {query, query()}
|
[
|
||||||
, {type, #{type => postgresql, desc => "Backend type."}}
|
{query, query()},
|
||||||
, {enable, #{type => boolean(),
|
{type, #{type => postgresql, desc => "Backend type."}},
|
||||||
desc => "Enable this backend.",
|
{enable, #{
|
||||||
default => true}}
|
type => boolean(),
|
||||||
|
desc => "Enable this backend.",
|
||||||
|
default => true
|
||||||
|
}}
|
||||||
] ++ emqx_connector_pgsql:fields(config);
|
] ++ emqx_connector_pgsql:fields(config);
|
||||||
fields(redis_single) ->
|
fields(redis_single) ->
|
||||||
connector_fields(redis, single) ++
|
connector_fields(redis, single) ++
|
||||||
|
@ -321,15 +332,16 @@ union_array(Item) when is_list(Item) ->
|
||||||
hoconsc:array(hoconsc:union(Item)).
|
hoconsc:array(hoconsc:union(Item)).
|
||||||
|
|
||||||
query() ->
|
query() ->
|
||||||
#{type => binary(),
|
#{
|
||||||
desc => "Database query used to retrieve authorization data.",
|
type => binary(),
|
||||||
validator => fun(S) ->
|
desc => "Database query used to retrieve authorization data.",
|
||||||
case size(S) > 0 of
|
validator => fun(S) ->
|
||||||
true -> ok;
|
case size(S) > 0 of
|
||||||
_ -> {error, "Request query"}
|
true -> ok;
|
||||||
end
|
_ -> {error, "Request query"}
|
||||||
end
|
end
|
||||||
}.
|
end
|
||||||
|
}.
|
||||||
|
|
||||||
connector_fields(DB) ->
|
connector_fields(DB) ->
|
||||||
connector_fields(DB, config).
|
connector_fields(DB, config).
|
||||||
|
|
|
@ -42,7 +42,8 @@ fields("telemetry") ->
|
||||||
fields("delayed") ->
|
fields("delayed") ->
|
||||||
[
|
[
|
||||||
{enable, hoconsc:mk(boolean(), #{default => false, desc => "Enable `delayed` module."})},
|
{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") ->
|
fields("rewrite") ->
|
||||||
[
|
[
|
||||||
|
|
|
@ -26,7 +26,8 @@ fields("retainer") ->
|
||||||
, {stop_publish_clear_msg, sc(boolean(),
|
, {stop_publish_clear_msg, sc(boolean(),
|
||||||
"When the retained flag of the `PUBLISH` message is set and Payload is empty, "
|
"When the retained flag of the `PUBLISH` message is set and Payload is empty, "
|
||||||
"whether to continue to publish the message.<br/>"
|
"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)}
|
false)}
|
||||||
, {backend, backend_config()}
|
, {backend, backend_config()}
|
||||||
];
|
];
|
||||||
|
@ -52,9 +53,12 @@ fields(flow_control) ->
|
||||||
0)}
|
0)}
|
||||||
, {batch_deliver_limiter, sc(emqx_limiter_schema:bucket_name(),
|
, {batch_deliver_limiter, sc(emqx_limiter_schema:bucket_name(),
|
||||||
"The rate limiter name for retained messages' delivery.<br/>"
|
"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 "
|
"Limiter helps to avoid delivering too many messages to the client at once, "
|
||||||
"to block or crash, or drop messages due to exceeding the size of the message queue.<br/>"
|
"which may cause the client "
|
||||||
"The names of the available rate limiters are taken from the existing rate limiters under `limiter.batch`.<br/>"
|
"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.",
|
"If this field is empty, limiter is not used.",
|
||||||
undefined)}
|
undefined)}
|
||||||
].
|
].
|
||||||
|
|
Loading…
Reference in New Issue