From 984a26945c5a11fa4223970c90ef20c9f2b75105 Mon Sep 17 00:00:00 2001
From: Shawn <506895667@qq.com>
Date: Sat, 23 Apr 2022 03:51:38 +0800
Subject: [PATCH 1/6] docs: add i18n ids
---
apps/emqx/src/emqx_schema.erl | 111 ++++++++++++++++--
apps/emqx_conf/src/emqx_conf_schema.erl | 2 +-
.../src/emqx_connector_schema_lib.erl | 2 +-
apps/emqx_gateway/src/emqx_gateway_schema.erl | 2 +-
4 files changed, 102 insertions(+), 15 deletions(-)
diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index a4a1c8598..78d6d6eb9 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -295,6 +295,7 @@ fields("authorization") ->
default => allow,
required => true,
%% TODO: make sources a reference link
+ desc_id => fields_authorization_no_match,
desc =>
"Default access control action if the user or client matches no ACL rules,\n"
"or if no such user or client is found by the configurable authorization\n"
@@ -308,6 +309,7 @@ fields("authorization") ->
#{
default => ignore,
required => true,
+ desc_id => fields_authorization_deny_action,
desc => "The action when the authorization check rejects an operation."
}
)},
@@ -324,6 +326,7 @@ fields("cache") ->
boolean(),
#{
default => true,
+ desc_id => fields_cache_enable,
desc => "Enable or disable the authorization cache."
}
)},
@@ -332,6 +335,7 @@ fields("cache") ->
range(1, 1048576),
#{
default => 32,
+ desc_id => fields_cache_max_size,
desc => "Maximum number of cached items."
}
)},
@@ -340,6 +344,7 @@ fields("cache") ->
duration(),
#{
default => "1m",
+ desc_id => fields_cache_ttl,
desc => "Time to live for the cached data."
}
)}
@@ -581,6 +586,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, integer()]),
#{
default => 1000,
+ desc_id => fields_rate_limit_max_conn_rate,
desc => "Maximum connections per second."
}
)},
@@ -589,6 +595,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, comma_separated_list()]),
#{
default => infinity,
+ desc_id => fields_rate_limit_conn_messages_in,
desc => "Message limit for the external MQTT connections."
}
)},
@@ -597,6 +604,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, comma_separated_list()]),
#{
default => infinity,
+ desc_id => fields_rate_limit_conn_bytes_in,
desc =>
"Limit the rate of receiving packets for a MQTT connection.\n"
"The rate is counted by bytes of packets per second."
@@ -758,6 +766,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_tcp_listener")),
#{
+ desc_id => fields_listeners_tcp,
desc => "TCP listeners",
required => {false, recursively}
}
@@ -766,6 +775,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_ssl_listener")),
#{
+ desc_id => fields_listeners_ssl,
desc => "SSL listeners",
required => {false, recursively}
}
@@ -774,6 +784,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_ws_listener")),
#{
+ desc_id => fields_listeners_ws,
desc => "HTTP websocket listeners",
required => {false, recursively}
}
@@ -782,6 +793,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_wss_listener")),
#{
+ desc_id => fields_listeners_wss,
desc => "HTTPS websocket listeners",
required => {false, recursively}
}
@@ -790,6 +802,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_quic_listener")),
#{
+ desc_id => fields_listeners_quic,
desc => "QUIC listeners",
required => {false, recursively}
}
@@ -852,24 +865,34 @@ fields("mqtt_quic_listener") ->
{"enabled",
sc(
boolean(),
- #{default => true, desc => "Enable QUIC listener."}
+ #{ default => true
+ , desc_id => fields_mqtt_quic_listener_enabled
+ , desc => "Enable QUIC listener."
+ }
)},
%% TODO: ensure cacertfile is configurable
{"certfile",
sc(
string(),
- #{desc => "Path to the certificate file."}
+ #{ desc => "Path to the certificate file."
+ , desc_id => fields_mqtt_quic_listener_certfile
+ }
)},
{"keyfile",
sc(
string(),
- #{desc => "Path to the secret key file."}
+ #{ desc => "Path to the secret key file."
+ , desc_id => fields_mqtt_quic_listener_keyfile
+ }
)},
{"ciphers", ciphers_schema(quic)},
{"idle_timeout",
sc(
duration(),
- #{default => "15s", desc => ?IDLE_TIMOUT_DESC}
+ #{ default => "15s"
+ , desc_id => fields_mqtt_quic_listener_idle_timeout
+ , desc => ?IDLE_TIMOUT_DESC
+ }
)}
] ++ base_listener();
fields("ws_opts") ->
@@ -879,6 +902,7 @@ fields("ws_opts") ->
string(),
#{
default => "/mqtt",
+ desc_id => fields_ws_opts_mqtt_path,
desc =>
"WebSocket's MQTT protocol path. So the address of\n"
" EMQX Broker's WebSocket is: ws://{ip}:{port}/mqtt
"
@@ -889,6 +913,7 @@ fields("ws_opts") ->
hoconsc:enum([single, multiple]),
#{
default => multiple,
+ desc_id => fields_ws_opts_mqtt_piggyback,
desc =>
"Whether a WebSocket message is allowed to contain multiple MQTT packets."
}
@@ -898,6 +923,7 @@ fields("ws_opts") ->
boolean(),
#{
default => false,
+ desc_id => fields_ws_opts_compress,
desc =>
"If true
, compress WebSocket messages using zlib
.
\n"
"The configuration items under deflate_opts
"
@@ -909,6 +935,7 @@ fields("ws_opts") ->
duration(),
#{
default => "15s",
+ desc_id => fields_ws_opts_idle_timeout,
desc => ?IDLE_TIMOUT_DESC
}
)},
@@ -917,6 +944,7 @@ fields("ws_opts") ->
hoconsc:union([infinity, integer()]),
#{
default => infinity,
+ desc_id => fields_ws_opts_max_frame_size,
desc => "The maximum length of a single MQTT packet."
}
)},
@@ -925,6 +953,7 @@ fields("ws_opts") ->
boolean(),
#{
default => true,
+ desc_id => fields_ws_opts_fail_if_no_subprotocol,
desc =>
"If true
, the server will return an error when\n"
" the client does not carry the Sec-WebSocket-Protocol
field.\n"
@@ -936,6 +965,7 @@ fields("ws_opts") ->
comma_separated_list(),
#{
default => "mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5",
+ desc_id => fields_ws_opts_supported_subprotocols,
desc => "Comma-separated list of supported subprotocols."
}
)},
@@ -944,6 +974,7 @@ fields("ws_opts") ->
boolean(),
#{
default => false,
+ desc_id => fields_ws_opts_check_origin_enable,
desc =>
"If true
, origin
HTTP header will be\n"
" validated against the list of allowed origins configured in check_origins
\n"
@@ -955,6 +986,7 @@ fields("ws_opts") ->
boolean(),
#{
default => true,
+ desc_id => fields_ws_opts_allow_origin_absence,
desc =>
"If false
and check_origin_enable
is\n"
" true
, the server will reject requests that don't have origin
\n"
@@ -966,6 +998,7 @@ fields("ws_opts") ->
hoconsc:array(binary()),
#{
default => [],
+ desc_id => fields_ws_opts_check_origins,
desc => "List of allowed origins.
See check_origin_enable
."
}
)},
@@ -974,6 +1007,7 @@ fields("ws_opts") ->
string(),
#{
default => "x-forwarded-for",
+ desc_id => fields_ws_opts_proxy_address_header,
desc =>
"HTTP header used to pass information about the client IP address.\n"
" Relevant when the EMQX cluster is deployed behind a load-balancer."
@@ -984,6 +1018,7 @@ fields("ws_opts") ->
string(),
#{
default => "x-forwarded-port",
+ desc_id => fields_ws_opts_proxy_port_header,
desc =>
"HTTP header used to pass information about the client port.\n"
" Relevant when the EMQX cluster is deployed behind a load-balancer."
@@ -1002,6 +1037,7 @@ fields("tcp_opts") ->
integer(),
#{
default => 100,
+ desc_id => fields_tcp_opts_active_n,
desc =>
"Specify the {active, N} option for this Socket.
\n"
" See: https://erlang.org/doc/man/inet.html#setopts-2"
@@ -1012,6 +1048,7 @@ fields("tcp_opts") ->
integer(),
#{
default => 1024,
+ desc_id => fields_tcp_opts_backlog,
desc =>
"TCP backlog defines the maximum length that the queue of\n"
" pending connections can grow to."
@@ -1022,6 +1059,7 @@ fields("tcp_opts") ->
duration(),
#{
default => "15s",
+ desc_id => fields_tcp_opts_send_timeout,
desc => "The TCP send timeout for the connections."
}
)},
@@ -1030,29 +1068,37 @@ fields("tcp_opts") ->
boolean(),
#{
default => true,
+ desc_id => fields_tcp_opts_send_timeout_close,
desc => "Close the connection if send timeout."
}
)},
{"recbuf",
sc(
bytesize(),
- #{desc => "The TCP receive buffer (OS kernel) for the connections."}
+ #{ desc => "The TCP receive buffer (OS kernel) for the connections."
+ , desc_id => fields_tcp_opts_recbuf
+ }
)},
{"sndbuf",
sc(
bytesize(),
- #{desc => "The TCP send buffer (OS kernel) for the connections."}
+ #{ desc => "The TCP send buffer (OS kernel) for the connections."
+ , desc_id => fields_tcp_opts_sndbuf
+ }
)},
{"buffer",
sc(
bytesize(),
- #{desc => "The size of the user-space buffer used by the driver."}
+ #{ desc => "The size of the user-space buffer used by the driver."
+ , desc_id => fields_tcp_opts_buffer
+ }
)},
{"high_watermark",
sc(
bytesize(),
#{
default => "1MB",
+ desc_id => fields_tcp_opts_high_watermark,
desc =>
"The socket is set to a busy state when the amount of data queued internally\n"
" by the VM socket implementation reaches this limit."
@@ -1063,6 +1109,7 @@ fields("tcp_opts") ->
boolean(),
#{
default => false,
+ desc_id => fields_tcp_opts_nodelay,
desc => "The TCP_NODELAY flag for the connections."
}
)},
@@ -1071,6 +1118,7 @@ fields("tcp_opts") ->
boolean(),
#{
default => true,
+ desc_id => fields_tcp_opts_reuseaddr,
desc => "The SO_REUSEADDR flag for the connections."
}
)}
@@ -1095,20 +1143,23 @@ fields("listener_wss_opts") ->
},
true
);
-fields(ssl_client_opts) ->
+fields("ssl_client_opts") ->
client_ssl_opts_schema(#{});
fields("deflate_opts") ->
[
{"level",
sc(
hoconsc:enum([none, default, best_compression, best_speed]),
- #{desc => "Compression level."}
+ #{ desc => "Compression level."
+ , desc_id => fields_deflate_opts_level
+ }
)},
{"mem_level",
sc(
range(1, 9),
#{
default => 8,
+ desc_id => fields_deflate_opts_mem_level,
desc =>
"Specifies the size of the compression state.
\n"
" Lower values decrease memory usage per connection."
@@ -1117,12 +1168,15 @@ fields("deflate_opts") ->
{"strategy",
sc(
hoconsc:enum([default, filtered, huffman_only, rle]),
- #{desc => "Specifies the compression strategy."}
+ #{ desc => "Specifies the compression strategy."
+ , desc_id => fields_deflate_opts_strategy
+ }
)},
{"server_context_takeover",
sc(
hoconsc:enum([takeover, no_takeover]),
#{
+ desc_id => fields_deflate_opts_server_context_takeover,
desc =>
"Takeover means the compression state is retained\n"
" between server messages."
@@ -1132,6 +1186,7 @@ fields("deflate_opts") ->
sc(
hoconsc:enum([takeover, no_takeover]),
#{
+ desc_id => fields_deflate_opts_client_context_takeover,
desc =>
"Takeover means the compression state is retained\n"
" between client messages."
@@ -1141,6 +1196,7 @@ fields("deflate_opts") ->
sc(
range(8, 15),
#{
+ desc_id => fields_deflate_opts_server_max_window_bits,
default => 15,
desc => "Specifies the size of the compression context for the server."
}
@@ -1149,6 +1205,7 @@ fields("deflate_opts") ->
sc(
range(8, 15),
#{
+ desc_id => fields_deflate_opts_client_max_window_bits,
default => 15,
desc => "Specifies the size of the compression context for the client."
}
@@ -1526,6 +1583,7 @@ fields("trace") ->
{"payload_encode",
sc(hoconsc:enum([hex, text, hidden]), #{
default => text,
+ desc_id => fields_trace_payload_encode,
desc =>
"Determine the format of the payload format in the trace file.
\n"
"`text`: Text-based protocol or plain text protocol.\n"
@@ -1543,6 +1601,7 @@ mqtt_listener() ->
sc(
hoconsc:array(string()),
#{
+ desc_id => mqtt_listener_access_rules,
desc =>
"The access control rules for this listener.
"
"See: https://github.com/emqtt/esockd#allowdeny",
@@ -1553,6 +1612,7 @@ mqtt_listener() ->
sc(
boolean(),
#{
+ desc_id => mqtt_listener_proxy_protocol,
default => false,
desc =>
"Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed\n"
@@ -1564,6 +1624,7 @@ mqtt_listener() ->
sc(
duration(),
#{
+ desc_id => mqtt_listener_proxy_protocol_timeout,
desc =>
"Timeout for proxy protocol. EMQX will close the TCP connection "
"if proxy protocol packet is not received within the timeout.",
@@ -1580,6 +1641,7 @@ base_listener() ->
sc(
hoconsc:union([ip_port(), integer()]),
#{
+ desc_id => base_listener_bind,
required => true,
desc => "IP address and port for the listening socket."
}
@@ -1589,6 +1651,7 @@ base_listener() ->
integer(),
#{
default => 16,
+ desc_id => base_listener_acceptors,
desc => "The size of the listener's receiving pool."
}
)},
@@ -1597,6 +1660,7 @@ base_listener() ->
hoconsc:union([infinity, integer()]),
#{
default => infinity,
+ desc_id => base_listener_max_connections,
desc => "The maximum number of concurrent connections allowed by the listener."
}
)},
@@ -1605,6 +1669,7 @@ base_listener() ->
binary(),
#{
default => <<>>,
+ desc_id => base_listener_mountpoint,
desc =>
"When publishing or subscribing, prefix all topics with a mountpoint string.\n"
" The prefixed string will be removed from the topic name when the message\n"
@@ -1627,6 +1692,7 @@ base_listener() ->
sc(
atom(),
#{
+ desc_id => base_listener_zone,
default => 'default',
desc => "The configuration zone to which the listener belongs."
}
@@ -1635,6 +1701,7 @@ base_listener() ->
sc(
map("ratelimit's type", emqx_limiter_schema:bucket_name()),
#{
+ desc_id => base_listener_limiter,
default => #{},
desc => "Type of the rate limit."
}
@@ -1738,7 +1805,7 @@ desc("listener_ssl_opts") ->
"Socket options for SSL connections.";
desc("listener_wss_opts") ->
"Socket options for WebSocket/SSL connections.";
-desc(ssl_client_opts) ->
+desc("ssl_client_opts") ->
"Socket options for SSL clients.";
desc("deflate_opts") ->
"Compression options.";
@@ -1814,6 +1881,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("enable", false),
+ desc_id => common_ssl_opts_schema_enable,
desc => "Enable TLS."
}
)},
@@ -1823,6 +1891,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("cacertfile"),
required => false,
+ desc_id => common_ssl_opts_schema_cacertfile,
desc =>
"Trusted PEM format CA certificates bundle file.
\n"
"The certificates in this file are used to verify the TLS peer's certificates.\n"
@@ -1839,6 +1908,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("certfile"),
required => false,
+ desc_id => common_ssl_opts_schema_certfile,
desc =>
"PEM format certificates chain file.
\n"
"The certificates in this file should be in reversed order of the certificate\n"
@@ -1854,6 +1924,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("keyfile"),
required => false,
+ desc_id => common_ssl_opts_schema_keyfile,
desc =>
"PEM format private key file."
}
@@ -1863,6 +1934,7 @@ common_ssl_opts_schema(Defaults) ->
hoconsc:enum([verify_peer, verify_none]),
#{
default => Df("verify", verify_none),
+ desc_id => common_ssl_opts_schema_verify,
desc =>
"Enable or disable peer verification."
}
@@ -1872,6 +1944,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("reuse_sessions", true),
+ desc_id => common_ssl_opts_schema_reuse_sessions,
desc =>
"Enable TLS session reuse."
}
@@ -1881,6 +1954,7 @@ common_ssl_opts_schema(Defaults) ->
integer(),
#{
default => Df("depth", 10),
+ desc_id => common_ssl_opts_schema_depth,
desc =>
"Maximum number of non-self-issued intermediate certificates that can follow "
"the peer certificate in a valid certification path. "
@@ -1895,6 +1969,7 @@ common_ssl_opts_schema(Defaults) ->
#{
sensitive => true,
required => false,
+ desc_id => common_ssl_opts_schema_password,
desc =>
"String containing the user's password. Only used if the private\n"
"key file is password-protected."
@@ -1905,6 +1980,7 @@ common_ssl_opts_schema(Defaults) ->
hoconsc:array(typerefl:atom()),
#{
default => default_tls_vsns(maps:get(versions, Defaults, tls_all_available)),
+ desc_id => common_ssl_opts_schema_versions,
desc =>
"All TLS/DTLS versions to be supported.
\n"
"NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config
\n"
@@ -1914,12 +1990,13 @@ common_ssl_opts_schema(Defaults) ->
}
)},
{"ciphers", ciphers_schema(D("ciphers"))},
- {user_lookup_fun,
+ {"user_lookup_fun",
sc(
typerefl:alias("string", any()),
#{
default => <<"emqx_tls_psk:lookup">>,
converter => fun ?MODULE:parse_user_lookup_fun/1,
+ desc_id => common_ssl_opts_schema_user_lookup_fun,
desc =>
"EMQX-internal callback that is used to lookup pre-shared key (PSK) identity."
}
@@ -1929,6 +2006,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("secure_renegotiate", true),
+ desc_id => common_ssl_opts_schema_secure_renegotiate,
desc =>
"SSL parameter renegotiation is a feature that allows a client and a server\n"
"to renegotiate the parameters of the SSL connection on the fly.\n"
@@ -1958,6 +2036,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
#{
default => D("dhfile"),
required => false,
+ desc_id => server_ssl_opts_schema_dhfile,
desc =>
"Path to a file containing PEM-encoded Diffie-Hellman parameters\n"
"to be used by the server if a cipher suite using Diffie-Hellman\n"
@@ -1971,6 +2050,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("fail_if_no_peer_cert", false),
+ desc_id => server_ssl_opts_schema_fail_if_no_peer_cert,
desc =>
"Used together with {verify, verify_peer} by an TLS/DTLS server.\n"
"If set to true, the server fails if the client does not have a\n"
@@ -1984,6 +2064,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("honor_cipher_order", true),
+ desc_id => server_ssl_opts_schema_honor_cipher_order,
desc =>
"An important security setting, it forces the cipher to be set based\n"
" on the server-specified order instead of the client-specified order,\n"
@@ -1996,6 +2077,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("client_renegotiation", true),
+ desc_id => server_ssl_opts_schema_client_renegotiation,
desc =>
"In protocols that support client-initiated renegotiation,\n"
"the cost of resources of such an operation is higher for the "
@@ -2015,6 +2097,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
duration(),
#{
default => Df("handshake_timeout", "15s"),
+ desc_id => server_ssl_opts_schema_handshake_timeout,
desc => "Maximum time duration allowed for the handshake to complete"
}
)}
@@ -2040,6 +2123,7 @@ client_ssl_opts_schema(Defaults1) ->
hoconsc:union([disable, string()]),
#{
required => false,
+ desc_id => client_ssl_opts_schema_server_name_indication,
desc =>
"Specify the host name to be used in TLS Server Name Indication extension.
\n"
"For instance, when connecting to \"server.example.net\", the genuine server\n"
@@ -2080,6 +2164,7 @@ ciphers_schema(Default) ->
true -> undefined;
false -> fun validate_ciphers/1
end,
+ desc_id => ciphers_schema_0,
desc =>
"This config holds TLS cipher suite names separated by comma,\n"
"or as an array of strings. e.g.\n"
@@ -2161,6 +2246,7 @@ ref(Module, Field) -> hoconsc:ref(Module, Field).
mk_duration(Desc, OverrideMeta) ->
DefaultMeta = #{
+ desc_id => mk_duration_0,
desc => Desc ++
" Time interval is a string that contains a number followed by time unit:
\n"
"- `ms` for milliseconds,\n"
@@ -2345,6 +2431,7 @@ authentication(Desc) ->
undefined -> Default;
Module -> hoconsc:lazy(Module:root_type())
end,
+ desc_id => authentication_0,
desc => iolist_to_binary([
Desc,
"\nAuthentication can be one single authenticator instance or a chain of "
diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl
index 0fcbc7b32..4c8916835 100644
--- a/apps/emqx_conf/src/emqx_conf_schema.erl
+++ b/apps/emqx_conf/src/emqx_conf_schema.erl
@@ -251,7 +251,7 @@ fields(cluster_etcd) ->
, desc => ?DESC(cluster_etcd_node_ttl)
})}
, {"ssl",
- sc(hoconsc:ref(emqx_schema, ssl_client_opts),
+ sc(hoconsc:ref(emqx_schema, "ssl_client_opts"),
#{ desc => ?DESC(cluster_etcd_ssl)
, 'readOnly' => true
})}
diff --git a/apps/emqx_connector/src/emqx_connector_schema_lib.erl b/apps/emqx_connector/src/emqx_connector_schema_lib.erl
index 5398ac9fe..8600253c6 100644
--- a/apps/emqx_connector/src/emqx_connector_schema_lib.erl
+++ b/apps/emqx_connector/src/emqx_connector_schema_lib.erl
@@ -53,7 +53,7 @@ roots() -> [].
fields(_) -> [].
ssl_fields() ->
- [ {ssl, #{type => hoconsc:ref(emqx_schema, ssl_client_opts),
+ [ {ssl, #{type => hoconsc:ref(emqx_schema, "ssl_client_opts"),
default => #{<<"enable">> => false},
desc => ?DESC("ssl")
}
diff --git a/apps/emqx_gateway/src/emqx_gateway_schema.erl b/apps/emqx_gateway/src/emqx_gateway_schema.erl
index c862baf58..686ba1cc7 100644
--- a/apps/emqx_gateway/src/emqx_gateway_schema.erl
+++ b/apps/emqx_gateway/src/emqx_gateway_schema.erl
@@ -348,7 +348,7 @@ fields(exproto_grpc_handler) ->
{address, sc(binary(), #{required => true, desc => ?DESC(exproto_grpc_handler_address)})},
{ssl,
sc(
- ref(emqx_schema, ssl_client_opts),
+ ref(emqx_schema, "ssl_client_opts"),
#{
required => {false, recursively},
desc => ?DESC(exproto_grpc_handler_ssl)
From 86863690cea45061fa25bf1df2cd5949b6ea92a9 Mon Sep 17 00:00:00 2001
From: Shawn <506895667@qq.com>
Date: Sat, 23 Apr 2022 03:52:20 +0800
Subject: [PATCH 2/6] docs: add generated i18n conf
---
apps/emqx/i18n/emqx_schema_i18n.conf | 1096 ++++++++++++++++++++++++++
1 file changed, 1096 insertions(+)
diff --git a/apps/emqx/i18n/emqx_schema_i18n.conf b/apps/emqx/i18n/emqx_schema_i18n.conf
index c1df430db..f889ac547 100644
--- a/apps/emqx/i18n/emqx_schema_i18n.conf
+++ b/apps/emqx/i18n/emqx_schema_i18n.conf
@@ -990,4 +990,1100 @@ NOTE: This is a cluster-wide configuration. It requires all nodes to be stopped
zh: """是否开启客户端已成功取消订阅主题事件消息。"""
}
}
+
+
+fields_authorization_no_match {
+ desc {
+ en: """
+Default access control action if the user or client matches no ACL rules,
+or if no such user or client is found by the configurable authorization
+sources such as built_in_database, an HTTP API, or a query against PostgreSQL.
+Find more details in 'authorization.sources' config.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_authorization_deny_action {
+ desc {
+ en: """
+The action when the authorization check rejects an operation.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_cache_enable {
+ desc {
+ en: """
+Enable or disable the authorization cache.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_cache_max_size {
+ desc {
+ en: """
+Maximum number of cached items.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_cache_ttl {
+ desc {
+ en: """
+Time to live for the cached data.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_level {
+ desc {
+ en: """
+Compression level.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_mem_level {
+ desc {
+ en: """
+Specifies the size of the compression state.
+ Lower values decrease memory usage per connection.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_strategy {
+ desc {
+ en: """
+Specifies the compression strategy.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_server_context_takeover {
+ desc {
+ en: """
+Takeover means the compression state is retained
+ between server messages.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_client_context_takeover {
+ desc {
+ en: """
+Takeover means the compression state is retained
+ between client messages.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_server_max_window_bits {
+ desc {
+ en: """
+Specifies the size of the compression context for the server.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_deflate_opts_client_max_window_bits {
+ desc {
+ en: """
+Specifies the size of the compression context for the client.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_enable {
+ desc {
+ en: """
+Enable TLS.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_cacertfile {
+ desc {
+ en: """
+Trusted PEM format CA certificates bundle file.
+The certificates in this file are used to verify the TLS peer's certificates.
+Append new certificates to the file if new CAs are to be trusted.
+There is no need to restart EMQX to have the updated file loaded, because
+the system regularly checks if file has been updated (and reload).
+NOTE: invalidating (deleting) a certificate from the file will not affect
+already established connections.
+
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_certfile {
+ desc {
+ en: """
+PEM format certificates chain file.
+The certificates in this file should be in reversed order of the certificate
+issue chain. That is, the host's certificate should be placed in the beginning
+of the file, followed by the immediate issuer certificate and so on.
+Although the root CA certificate is optional, it should be placed at the end of
+the file if it is to be added.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_keyfile {
+ desc {
+ en: """
+PEM format private key file.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_verify {
+ desc {
+ en: """
+Enable or disable peer verification.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_reuse_sessions {
+ desc {
+ en: """
+Enable TLS session reuse.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_depth {
+ desc {
+ en: """
+Maximum number of non-self-issued intermediate certificates that can follow the peer certificate in a valid certification path. So, if depth is 0 the PEER must be signed by the trusted ROOT-CA directly; if 1 the path can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, and so on. The default value is 10.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_password {
+ desc {
+ en: """
+String containing the user's password. Only used if the private
+key file is password-protected.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_versions {
+ desc {
+ en: """
+All TLS/DTLS versions to be supported.
+NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config
+In case PSK cipher suites are intended, make sure to configured
+['tlsv1.2', 'tlsv1.1']
here.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+ciphers_schema_0 {
+ desc {
+ en: """
+This config holds TLS cipher suite names separated by comma,
+or as an array of strings. e.g.
+"TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256"
or
+["TLS_AES_256_GCM_SHA384","TLS_AES_128_GCM_SHA256"]
.
+
+Ciphers (and their ordering) define the way in which the
+client and server encrypts information over the network connection.
+Selecting a good cipher suite is critical for the
+application's data security, confidentiality and performance.
+
+The names should be in OpenSSL string format (not RFC format).
+All default values and examples provided by EMQX config
+documentation are all in OpenSSL format.
+
+NOTE: Certain cipher suites are only compatible with
+specific TLS versions
('tlsv1.1', 'tlsv1.2' or 'tlsv1.3')
+incompatible cipher suites will be silently dropped.
+For instance, if only 'tlsv1.3' is given in the versions
,
+configuring cipher suites for other versions will have no effect.
+
+
+NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config
+If PSK cipher suites are intended, 'tlsv1.3' should be disabled from versions
.
+PSK cipher suites: "RSA-PSK-AES256-GCM-SHA384,RSA-PSK-AES256-CBC-SHA384,
+RSA-PSK-AES128-GCM-SHA256,RSA-PSK-AES128-CBC-SHA256,
+RSA-PSK-AES256-CBC-SHA,RSA-PSK-AES128-CBC-SHA,
+RSA-PSK-DES-CBC3-SHA,RSA-PSK-RC4-SHA"
+
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_user_lookup_fun {
+ desc {
+ en: """
+EMQX-internal callback that is used to lookup pre-shared key (PSK) identity.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+common_ssl_opts_schema_secure_renegotiate {
+ desc {
+ en: """
+SSL parameter renegotiation is a feature that allows a client and a server
+to renegotiate the parameters of the SSL connection on the fly.
+RFC 5746 defines a more secure way of doing this. By enabling secure renegotiation,
+you drop support for the insecure renegotiation, prone to MitM attacks.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+server_ssl_opts_schema_dhfile {
+ desc {
+ en: """
+Path to a file containing PEM-encoded Diffie-Hellman parameters
+to be used by the server if a cipher suite using Diffie-Hellman
+key exchange is negotiated. If not specified, default parameters
+are used.
+NOTE: The dhfile
option is not supported by TLS 1.3.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+server_ssl_opts_schema_fail_if_no_peer_cert {
+ desc {
+ en: """
+Used together with {verify, verify_peer} by an TLS/DTLS server.
+If set to true, the server fails if the client does not have a
+certificate to send, that is, sends an empty certificate.
+If set to false, it fails only if the client sends an invalid
+certificate (an empty certificate is considered valid).
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+server_ssl_opts_schema_honor_cipher_order {
+ desc {
+ en: """
+An important security setting, it forces the cipher to be set based
+ on the server-specified order instead of the client-specified order,
+ hence enforcing the (usually more properly configured) security
+ ordering of the server administrator.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+server_ssl_opts_schema_client_renegotiation {
+ desc {
+ en: """
+In protocols that support client-initiated renegotiation,
+the cost of resources of such an operation is higher for the server than the client.
+This can act as a vector for denial of service attacks.
+The SSL application already takes measures to counter-act such attempts,
+but client-initiated renegotiation can be strictly disabled by setting this option to false.
+The default value is true. Note that disabling renegotiation can result in
+long-lived connections becoming unusable due to limits on
+the number of messages the underlying cipher suite can encipher.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+server_ssl_opts_schema_handshake_timeout {
+ desc {
+ en: """
+Maximum time duration allowed for the handshake to complete
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_listeners_tcp {
+ desc {
+ en: """
+TCP listeners
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_listeners_ssl {
+ desc {
+ en: """
+SSL listeners
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_listeners_ws {
+ desc {
+ en: """
+HTTP websocket listeners
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_listeners_wss {
+ desc {
+ en: """
+HTTPS websocket listeners
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_listeners_quic {
+ desc {
+ en: """
+QUIC listeners
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_mqtt_quic_listener_enabled {
+ desc {
+ en: """
+Enable QUIC listener.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_mqtt_quic_listener_certfile {
+ desc {
+ en: """
+Path to the certificate file.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_mqtt_quic_listener_keyfile {
+ desc {
+ en: """
+Path to the secret key file.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_mqtt_quic_listener_idle_timeout {
+ desc {
+ en: """
+Close transport-layer connections from the clients that have not sent MQTT CONNECT
+message within this interval.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_bind {
+ desc {
+ en: """
+IP address and port for the listening socket.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_acceptors {
+ desc {
+ en: """
+The size of the listener's receiving pool.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_max_connections {
+ desc {
+ en: """
+The maximum number of concurrent connections allowed by the listener.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_mountpoint {
+ desc {
+ en: """
+When publishing or subscribing, prefix all topics with a mountpoint string.
+ The prefixed string will be removed from the topic name when the message
+ is delivered to the subscriber. The mountpoint is a way that users can use
+ to implement isolation of message routing between different listeners.
+ For example if a client A subscribes to `t` with `listeners.tcp..mountpoint`
+ set to `some_tenant`, then the client actually subscribes to the topic
+ `some_tenant/t`. Similarly, if another client B (connected to the same listener
+ as the client A) sends a message to topic `t`, the message is routed
+ to all the clients subscribed `some_tenant/t`, so client A will receive the
+ message, with topic name `t`.
+ Set to `""` to disable the feature.
+
+ Variables in mountpoint string:
+ - ${clientid}
: clientid
+ - ${username}
: username
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_zone {
+ desc {
+ en: """
+The configuration zone to which the listener belongs.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+base_listener_limiter {
+ desc {
+ en: """
+Type of the rate limit.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+mqtt_listener_access_rules {
+ desc {
+ en: """
+The access control rules for this listener.
See: https://github.com/emqtt/esockd#allowdeny
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+mqtt_listener_proxy_protocol {
+ desc {
+ en: """
+Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed
+ behind HAProxy or Nginx.
See: https://www.haproxy.com/blog/haproxy/proxy-protocol/
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+mqtt_listener_proxy_protocol_timeout {
+ desc {
+ en: """
+Timeout for proxy protocol. EMQX will close the TCP connection if proxy protocol packet is not received within the timeout.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+authentication_0 {
+ desc {
+ en: """
+Per-listener authentication override
+Authentication can be one single authenticator instance or a chain of authenticators as an array.
+When authenticating a login (username, client ID, etc.) the authenticators are checked in the configured order.
+
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_rate_limit_max_conn_rate {
+ desc {
+ en: """
+Maximum connections per second.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_rate_limit_conn_messages_in {
+ desc {
+ en: """
+Message limit for the external MQTT connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_rate_limit_conn_bytes_in {
+ desc {
+ en: """
+Limit the rate of receiving packets for a MQTT connection.
+The rate is counted by bytes of packets per second.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+client_ssl_opts_schema_server_name_indication {
+ desc {
+ en: """
+Specify the host name to be used in TLS Server Name Indication extension.
+For instance, when connecting to "server.example.net", the genuine server
+which accepts the connection and performs TLS handshake may differ from the
+host the TLS client initially connects to, e.g. when connecting to an IP address
+or when the host has multiple resolvable DNS records
+If not specified, it will default to the host name string which is used
+to establish the connection, unless it is IP addressed used.
+The host name is then also used in the host name verification of the peer
+certificate.
The special value 'disable' prevents the Server Name
+Indication extension from being sent and disables the hostname
+verification check.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_active_n {
+ desc {
+ en: """
+Specify the {active, N} option for this Socket.
+ See: https://erlang.org/doc/man/inet.html#setopts-2
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_backlog {
+ desc {
+ en: """
+TCP backlog defines the maximum length that the queue of
+ pending connections can grow to.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_send_timeout {
+ desc {
+ en: """
+The TCP send timeout for the connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_send_timeout_close {
+ desc {
+ en: """
+Close the connection if send timeout.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_recbuf {
+ desc {
+ en: """
+The TCP receive buffer (OS kernel) for the connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_sndbuf {
+ desc {
+ en: """
+The TCP send buffer (OS kernel) for the connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_buffer {
+ desc {
+ en: """
+The size of the user-space buffer used by the driver.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_high_watermark {
+ desc {
+ en: """
+The socket is set to a busy state when the amount of data queued internally
+ by the VM socket implementation reaches this limit.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_nodelay {
+ desc {
+ en: """
+The TCP_NODELAY flag for the connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_tcp_opts_reuseaddr {
+ desc {
+ en: """
+The SO_REUSEADDR flag for the connections.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_trace_payload_encode {
+ desc {
+ en: """
+Determine the format of the payload format in the trace file.
+`text`: Text-based protocol or plain text protocol.
+ It is recommended when payload is JSON encoded.
+`hex`: Binary hexadecimal encode. It is recommended when payload is a custom binary protocol.
+`hidden`: payload is obfuscated as `******`
+
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_mqtt_path {
+ desc {
+ en: """
+WebSocket's MQTT protocol path. So the address of
+ EMQX Broker's WebSocket is: ws://{ip}:{port}/mqtt
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_mqtt_piggyback {
+ desc {
+ en: """
+Whether a WebSocket message is allowed to contain multiple MQTT packets.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_compress {
+ desc {
+ en: """
+If true
, compress WebSocket messages using zlib
.
+The configuration items under deflate_opts
belong to the compression-related parameter configuration.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_idle_timeout {
+ desc {
+ en: """
+Close transport-layer connections from the clients that have not sent MQTT CONNECT
+message within this interval.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_max_frame_size {
+ desc {
+ en: """
+The maximum length of a single MQTT packet.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_fail_if_no_subprotocol {
+ desc {
+ en: """
+If true
, the server will return an error when
+ the client does not carry the Sec-WebSocket-Protocol
field.
+
Note: WeChat applet needs to disable this verification.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_supported_subprotocols {
+ desc {
+ en: """
+Comma-separated list of supported subprotocols.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_check_origin_enable {
+ desc {
+ en: """
+If true
, origin
HTTP header will be
+ validated against the list of allowed origins configured in check_origins
+ parameter.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_allow_origin_absence {
+ desc {
+ en: """
+If false
and check_origin_enable
is
+ true
, the server will reject requests that don't have origin
+ HTTP header.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_check_origins {
+ desc {
+ en: """
+List of allowed origins.
See check_origin_enable
.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_proxy_address_header {
+ desc {
+ en: """
+HTTP header used to pass information about the client IP address.
+ Relevant when the EMQX cluster is deployed behind a load-balancer.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
+fields_ws_opts_proxy_port_header {
+ desc {
+ en: """
+HTTP header used to pass information about the client port.
+ Relevant when the EMQX cluster is deployed behind a load-balancer.
+"""
+ zh: """"""
+ }
+ label: {
+ en: ""
+ zh: ""
+ }
+}
+
}
From 093d121bb28b7f522705a4c0cffd3cb41ea6b0d9 Mon Sep 17 00:00:00 2001
From: Shawn <506895667@qq.com>
Date: Sat, 23 Apr 2022 03:59:50 +0800
Subject: [PATCH 3/6] docs: changes desc to ?DESC
---
apps/emqx/src/emqx_schema.erl | 376 ++++++++--------------------------
1 file changed, 84 insertions(+), 292 deletions(-)
diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index 78d6d6eb9..ff95414f8 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -102,11 +102,6 @@
-elvis([{elvis_style, god_modules, disable}]).
--define(IDLE_TIMOUT_DESC,
- "Close transport-layer connections from the clients that have not sent MQTT CONNECT\n"
- "message within this interval."
-).
-
namespace() -> undefined.
roots() ->
@@ -295,12 +290,7 @@ fields("authorization") ->
default => allow,
required => true,
%% TODO: make sources a reference link
- desc_id => fields_authorization_no_match,
- desc =>
- "Default access control action if the user or client matches no ACL rules,\n"
- "or if no such user or client is found by the configurable authorization\n"
- "sources such as built_in_database, an HTTP API, or a query against PostgreSQL.\n"
- "Find more details in 'authorization.sources' config."
+ desc => ?DESC(fields_authorization_no_match)
}
)},
{"deny_action",
@@ -309,8 +299,7 @@ fields("authorization") ->
#{
default => ignore,
required => true,
- desc_id => fields_authorization_deny_action,
- desc => "The action when the authorization check rejects an operation."
+ desc => ?DESC(fields_authorization_deny_action)
}
)},
{"cache",
@@ -326,8 +315,7 @@ fields("cache") ->
boolean(),
#{
default => true,
- desc_id => fields_cache_enable,
- desc => "Enable or disable the authorization cache."
+ desc => ?DESC(fields_cache_enable)
}
)},
{"max_size",
@@ -335,8 +323,7 @@ fields("cache") ->
range(1, 1048576),
#{
default => 32,
- desc_id => fields_cache_max_size,
- desc => "Maximum number of cached items."
+ desc => ?DESC(fields_cache_max_size)
}
)},
{"ttl",
@@ -344,8 +331,7 @@ fields("cache") ->
duration(),
#{
default => "1m",
- desc_id => fields_cache_ttl,
- desc => "Time to live for the cached data."
+ desc => ?DESC(fields_cache_ttl)
}
)}
];
@@ -586,8 +572,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, integer()]),
#{
default => 1000,
- desc_id => fields_rate_limit_max_conn_rate,
- desc => "Maximum connections per second."
+ desc => ?DESC(fields_rate_limit_max_conn_rate)
}
)},
{"conn_messages_in",
@@ -595,8 +580,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, comma_separated_list()]),
#{
default => infinity,
- desc_id => fields_rate_limit_conn_messages_in,
- desc => "Message limit for the external MQTT connections."
+ desc => ?DESC(fields_rate_limit_conn_messages_in)
}
)},
{"conn_bytes_in",
@@ -604,10 +588,7 @@ fields("rate_limit") ->
hoconsc:union([infinity, comma_separated_list()]),
#{
default => infinity,
- desc_id => fields_rate_limit_conn_bytes_in,
- desc =>
- "Limit the rate of receiving packets for a MQTT connection.\n"
- "The rate is counted by bytes of packets per second."
+ desc => ?DESC(fields_rate_limit_conn_bytes_in)
}
)}
];
@@ -766,8 +747,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_tcp_listener")),
#{
- desc_id => fields_listeners_tcp,
- desc => "TCP listeners",
+ desc => ?DESC(fields_listeners_tcp),
required => {false, recursively}
}
)},
@@ -775,8 +755,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_ssl_listener")),
#{
- desc_id => fields_listeners_ssl,
- desc => "SSL listeners",
+ desc => ?DESC(fields_listeners_ssl),
required => {false, recursively}
}
)},
@@ -784,8 +763,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_ws_listener")),
#{
- desc_id => fields_listeners_ws,
- desc => "HTTP websocket listeners",
+ desc => ?DESC(fields_listeners_ws),
required => {false, recursively}
}
)},
@@ -793,8 +771,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_wss_listener")),
#{
- desc_id => fields_listeners_wss,
- desc => "HTTPS websocket listeners",
+ desc => ?DESC(fields_listeners_wss),
required => {false, recursively}
}
)},
@@ -802,8 +779,7 @@ fields("listeners") ->
sc(
map(name, ref("mqtt_quic_listener")),
#{
- desc_id => fields_listeners_quic,
- desc => "QUIC listeners",
+ desc => ?DESC(fields_listeners_quic),
required => {false, recursively}
}
)}
@@ -866,23 +842,20 @@ fields("mqtt_quic_listener") ->
sc(
boolean(),
#{ default => true
- , desc_id => fields_mqtt_quic_listener_enabled
- , desc => "Enable QUIC listener."
+ , desc => ?DESC(fields_mqtt_quic_listener_enabled)
}
)},
%% TODO: ensure cacertfile is configurable
{"certfile",
sc(
string(),
- #{ desc => "Path to the certificate file."
- , desc_id => fields_mqtt_quic_listener_certfile
+ #{ desc => ?DESC(fields_mqtt_quic_listener_certfile)
}
)},
{"keyfile",
sc(
string(),
- #{ desc => "Path to the secret key file."
- , desc_id => fields_mqtt_quic_listener_keyfile
+ #{ desc => ?DESC(fields_mqtt_quic_listener_keyfile)
}
)},
{"ciphers", ciphers_schema(quic)},
@@ -890,8 +863,7 @@ fields("mqtt_quic_listener") ->
sc(
duration(),
#{ default => "15s"
- , desc_id => fields_mqtt_quic_listener_idle_timeout
- , desc => ?IDLE_TIMOUT_DESC
+ , desc => ?DESC(fields_mqtt_quic_listener_idle_timeout)
}
)}
] ++ base_listener();
@@ -902,10 +874,7 @@ fields("ws_opts") ->
string(),
#{
default => "/mqtt",
- desc_id => fields_ws_opts_mqtt_path,
- desc =>
- "WebSocket's MQTT protocol path. So the address of\n"
- " EMQX Broker's WebSocket is: ws://{ip}:{port}/mqtt
"
+ desc => ?DESC(fields_ws_opts_mqtt_path)
}
)},
{"mqtt_piggyback",
@@ -913,9 +882,7 @@ fields("ws_opts") ->
hoconsc:enum([single, multiple]),
#{
default => multiple,
- desc_id => fields_ws_opts_mqtt_piggyback,
- desc =>
- "Whether a WebSocket message is allowed to contain multiple MQTT packets."
+ desc => ?DESC(fields_ws_opts_mqtt_piggyback)
}
)},
{"compress",
@@ -923,11 +890,7 @@ fields("ws_opts") ->
boolean(),
#{
default => false,
- desc_id => fields_ws_opts_compress,
- desc =>
- "If true
, compress WebSocket messages using zlib
.
\n"
- "The configuration items under deflate_opts
"
- "belong to the compression-related parameter configuration."
+ desc => ?DESC(fields_ws_opts_compress)
}
)},
{"idle_timeout",
@@ -935,8 +898,7 @@ fields("ws_opts") ->
duration(),
#{
default => "15s",
- desc_id => fields_ws_opts_idle_timeout,
- desc => ?IDLE_TIMOUT_DESC
+ desc => ?DESC(fields_mqtt_quic_listener_idle_timeout)
}
)},
{"max_frame_size",
@@ -944,8 +906,7 @@ fields("ws_opts") ->
hoconsc:union([infinity, integer()]),
#{
default => infinity,
- desc_id => fields_ws_opts_max_frame_size,
- desc => "The maximum length of a single MQTT packet."
+ desc => ?DESC(fields_ws_opts_max_frame_size)
}
)},
{"fail_if_no_subprotocol",
@@ -953,11 +914,7 @@ fields("ws_opts") ->
boolean(),
#{
default => true,
- desc_id => fields_ws_opts_fail_if_no_subprotocol,
- desc =>
- "If true
, the server will return an error when\n"
- " the client does not carry the Sec-WebSocket-Protocol
field.\n"
- "
Note: WeChat applet needs to disable this verification."
+ desc => ?DESC(fields_ws_opts_fail_if_no_subprotocol)
}
)},
{"supported_subprotocols",
@@ -965,8 +922,7 @@ fields("ws_opts") ->
comma_separated_list(),
#{
default => "mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5",
- desc_id => fields_ws_opts_supported_subprotocols,
- desc => "Comma-separated list of supported subprotocols."
+ desc => ?DESC(fields_ws_opts_supported_subprotocols)
}
)},
{"check_origin_enable",
@@ -974,11 +930,7 @@ fields("ws_opts") ->
boolean(),
#{
default => false,
- desc_id => fields_ws_opts_check_origin_enable,
- desc =>
- "If true
, origin
HTTP header will be\n"
- " validated against the list of allowed origins configured in check_origins
\n"
- " parameter."
+ desc => ?DESC(fields_ws_opts_check_origin_enable)
}
)},
{"allow_origin_absence",
@@ -986,11 +938,7 @@ fields("ws_opts") ->
boolean(),
#{
default => true,
- desc_id => fields_ws_opts_allow_origin_absence,
- desc =>
- "If false
and check_origin_enable
is\n"
- " true
, the server will reject requests that don't have origin
\n"
- " HTTP header."
+ desc => ?DESC(fields_ws_opts_allow_origin_absence)
}
)},
{"check_origins",
@@ -998,8 +946,7 @@ fields("ws_opts") ->
hoconsc:array(binary()),
#{
default => [],
- desc_id => fields_ws_opts_check_origins,
- desc => "List of allowed origins.
See check_origin_enable
."
+ desc => ?DESC(fields_ws_opts_check_origins)
}
)},
{"proxy_address_header",
@@ -1007,10 +954,7 @@ fields("ws_opts") ->
string(),
#{
default => "x-forwarded-for",
- desc_id => fields_ws_opts_proxy_address_header,
- desc =>
- "HTTP header used to pass information about the client IP address.\n"
- " Relevant when the EMQX cluster is deployed behind a load-balancer."
+ desc => ?DESC(fields_ws_opts_proxy_address_header)
}
)},
{"proxy_port_header",
@@ -1018,10 +962,7 @@ fields("ws_opts") ->
string(),
#{
default => "x-forwarded-port",
- desc_id => fields_ws_opts_proxy_port_header,
- desc =>
- "HTTP header used to pass information about the client port.\n"
- " Relevant when the EMQX cluster is deployed behind a load-balancer."
+ desc => ?DESC(fields_ws_opts_proxy_port_header)
}
)},
{"deflate_opts",
@@ -1037,10 +978,7 @@ fields("tcp_opts") ->
integer(),
#{
default => 100,
- desc_id => fields_tcp_opts_active_n,
- desc =>
- "Specify the {active, N} option for this Socket.
\n"
- " See: https://erlang.org/doc/man/inet.html#setopts-2"
+ desc => ?DESC(fields_tcp_opts_active_n)
}
)},
{"backlog",
@@ -1048,10 +986,7 @@ fields("tcp_opts") ->
integer(),
#{
default => 1024,
- desc_id => fields_tcp_opts_backlog,
- desc =>
- "TCP backlog defines the maximum length that the queue of\n"
- " pending connections can grow to."
+ desc => ?DESC(fields_tcp_opts_backlog)
}
)},
{"send_timeout",
@@ -1059,8 +994,7 @@ fields("tcp_opts") ->
duration(),
#{
default => "15s",
- desc_id => fields_tcp_opts_send_timeout,
- desc => "The TCP send timeout for the connections."
+ desc => ?DESC(fields_tcp_opts_send_timeout)
}
)},
{"send_timeout_close",
@@ -1068,29 +1002,25 @@ fields("tcp_opts") ->
boolean(),
#{
default => true,
- desc_id => fields_tcp_opts_send_timeout_close,
- desc => "Close the connection if send timeout."
+ desc => ?DESC(fields_tcp_opts_send_timeout_close)
}
)},
{"recbuf",
sc(
bytesize(),
- #{ desc => "The TCP receive buffer (OS kernel) for the connections."
- , desc_id => fields_tcp_opts_recbuf
+ #{ desc => ?DESC(fields_tcp_opts_recbuf)
}
)},
{"sndbuf",
sc(
bytesize(),
- #{ desc => "The TCP send buffer (OS kernel) for the connections."
- , desc_id => fields_tcp_opts_sndbuf
+ #{ desc => ?DESC(fields_tcp_opts_sndbuf)
}
)},
{"buffer",
sc(
bytesize(),
- #{ desc => "The size of the user-space buffer used by the driver."
- , desc_id => fields_tcp_opts_buffer
+ #{ desc => ?DESC(fields_tcp_opts_buffer)
}
)},
{"high_watermark",
@@ -1098,10 +1028,7 @@ fields("tcp_opts") ->
bytesize(),
#{
default => "1MB",
- desc_id => fields_tcp_opts_high_watermark,
- desc =>
- "The socket is set to a busy state when the amount of data queued internally\n"
- " by the VM socket implementation reaches this limit."
+ desc => ?DESC(fields_tcp_opts_high_watermark)
}
)},
{"nodelay",
@@ -1109,8 +1036,7 @@ fields("tcp_opts") ->
boolean(),
#{
default => false,
- desc_id => fields_tcp_opts_nodelay,
- desc => "The TCP_NODELAY flag for the connections."
+ desc => ?DESC(fields_tcp_opts_nodelay)
}
)},
{"reuseaddr",
@@ -1118,8 +1044,7 @@ fields("tcp_opts") ->
boolean(),
#{
default => true,
- desc_id => fields_tcp_opts_reuseaddr,
- desc => "The SO_REUSEADDR flag for the connections."
+ desc => ?DESC(fields_tcp_opts_reuseaddr)
}
)}
];
@@ -1150,8 +1075,7 @@ fields("deflate_opts") ->
{"level",
sc(
hoconsc:enum([none, default, best_compression, best_speed]),
- #{ desc => "Compression level."
- , desc_id => fields_deflate_opts_level
+ #{ desc => ?DESC(fields_deflate_opts_level)
}
)},
{"mem_level",
@@ -1159,55 +1083,43 @@ fields("deflate_opts") ->
range(1, 9),
#{
default => 8,
- desc_id => fields_deflate_opts_mem_level,
- desc =>
- "Specifies the size of the compression state.
\n"
- " Lower values decrease memory usage per connection."
+ desc => ?DESC(fields_deflate_opts_mem_level)
}
)},
{"strategy",
sc(
hoconsc:enum([default, filtered, huffman_only, rle]),
- #{ desc => "Specifies the compression strategy."
- , desc_id => fields_deflate_opts_strategy
+ #{ desc => ?DESC(fields_deflate_opts_strategy)
}
)},
{"server_context_takeover",
sc(
hoconsc:enum([takeover, no_takeover]),
#{
- desc_id => fields_deflate_opts_server_context_takeover,
- desc =>
- "Takeover means the compression state is retained\n"
- " between server messages."
+ desc => ?DESC(fields_deflate_opts_server_context_takeover)
}
)},
{"client_context_takeover",
sc(
hoconsc:enum([takeover, no_takeover]),
#{
- desc_id => fields_deflate_opts_client_context_takeover,
- desc =>
- "Takeover means the compression state is retained\n"
- " between client messages."
+ desc => ?DESC(fields_deflate_opts_client_context_takeover)
}
)},
{"server_max_window_bits",
sc(
range(8, 15),
#{
- desc_id => fields_deflate_opts_server_max_window_bits,
- default => 15,
- desc => "Specifies the size of the compression context for the server."
+ desc => ?DESC(fields_deflate_opts_server_max_window_bits),
+ default => 15
}
)},
{"client_max_window_bits",
sc(
range(8, 15),
#{
- desc_id => fields_deflate_opts_client_max_window_bits,
- default => 15,
- desc => "Specifies the size of the compression context for the client."
+ desc => ?DESC(fields_deflate_opts_client_max_window_bits),
+ default => 15
}
)}
];
@@ -1583,14 +1495,7 @@ fields("trace") ->
{"payload_encode",
sc(hoconsc:enum([hex, text, hidden]), #{
default => text,
- desc_id => fields_trace_payload_encode,
- desc =>
- "Determine the format of the payload format in the trace file.
\n"
- "`text`: Text-based protocol or plain text protocol.\n"
- " It is recommended when payload is JSON encoded.
\n"
- "`hex`: Binary hexadecimal encode. It is recommended when payload is "
- "a custom binary protocol.
\n"
- "`hidden`: payload is obfuscated as `******`\n"
+ desc => ?DESC(fields_trace_payload_encode)
})}
].
@@ -1601,10 +1506,7 @@ mqtt_listener() ->
sc(
hoconsc:array(string()),
#{
- desc_id => mqtt_listener_access_rules,
- desc =>
- "The access control rules for this listener.
"
- "See: https://github.com/emqtt/esockd#allowdeny",
+ desc => ?DESC(mqtt_listener_access_rules),
default => [<<"allow all">>]
}
)},
@@ -1612,22 +1514,15 @@ mqtt_listener() ->
sc(
boolean(),
#{
- desc_id => mqtt_listener_proxy_protocol,
- default => false,
- desc =>
- "Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed\n"
- " behind HAProxy or Nginx.
"
- "See: https://www.haproxy.com/blog/haproxy/proxy-protocol/"
+ desc => ?DESC(mqtt_listener_proxy_protocol),
+ default => false
}
)},
{"proxy_protocol_timeout",
sc(
duration(),
#{
- desc_id => mqtt_listener_proxy_protocol_timeout,
- desc =>
- "Timeout for proxy protocol. EMQX will close the TCP connection "
- "if proxy protocol packet is not received within the timeout.",
+ desc => ?DESC(mqtt_listener_proxy_protocol_timeout),
default => "3s"
}
)},
@@ -1641,9 +1536,8 @@ base_listener() ->
sc(
hoconsc:union([ip_port(), integer()]),
#{
- desc_id => base_listener_bind,
- required => true,
- desc => "IP address and port for the listening socket."
+ desc => ?DESC(base_listener_bind),
+ required => true
}
)},
{"acceptors",
@@ -1651,8 +1545,7 @@ base_listener() ->
integer(),
#{
default => 16,
- desc_id => base_listener_acceptors,
- desc => "The size of the listener's receiving pool."
+ desc => ?DESC(base_listener_acceptors)
}
)},
{"max_connections",
@@ -1660,8 +1553,7 @@ base_listener() ->
hoconsc:union([infinity, integer()]),
#{
default => infinity,
- desc_id => base_listener_max_connections,
- desc => "The maximum number of concurrent connections allowed by the listener."
+ desc => ?DESC(base_listener_max_connections)
}
)},
{"mountpoint",
@@ -1669,41 +1561,23 @@ base_listener() ->
binary(),
#{
default => <<>>,
- desc_id => base_listener_mountpoint,
- desc =>
- "When publishing or subscribing, prefix all topics with a mountpoint string.\n"
- " The prefixed string will be removed from the topic name when the message\n"
- " is delivered to the subscriber. The mountpoint is a way that users can use\n"
- " to implement isolation of message routing between different listeners.\n"
- " For example if a client A subscribes to `t` with `listeners.tcp..mountpoint`\n"
- " set to `some_tenant`, then the client actually subscribes to the topic\n"
- " `some_tenant/t`. Similarly, if another client B (connected to the same listener\n"
- " as the client A) sends a message to topic `t`, the message is routed\n"
- " to all the clients subscribed `some_tenant/t`, so client A will receive the\n"
- " message, with topic name `t`.
\n"
- " Set to `\"\"` to disable the feature.
\n"
- "\n"
- " Variables in mountpoint string:\n"
- " - ${clientid}
: clientid\n"
- " - ${username}
: username"
+ desc => ?DESC(base_listener_mountpoint)
}
)},
{"zone",
sc(
atom(),
#{
- desc_id => base_listener_zone,
- default => 'default',
- desc => "The configuration zone to which the listener belongs."
+ desc => ?DESC(base_listener_zone),
+ default => 'default'
}
)},
{"limiter",
sc(
map("ratelimit's type", emqx_limiter_schema:bucket_name()),
#{
- desc_id => base_listener_limiter,
- default => #{},
- desc => "Type of the rate limit."
+ desc => ?DESC(base_listener_limiter),
+ default => #{}
}
)}
].
@@ -1881,8 +1755,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("enable", false),
- desc_id => common_ssl_opts_schema_enable,
- desc => "Enable TLS."
+ desc => ?DESC(common_ssl_opts_schema_enable)
}
)},
{"cacertfile",
@@ -1891,15 +1764,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("cacertfile"),
required => false,
- desc_id => common_ssl_opts_schema_cacertfile,
- desc =>
- "Trusted PEM format CA certificates bundle file.
\n"
- "The certificates in this file are used to verify the TLS peer's certificates.\n"
- "Append new certificates to the file if new CAs are to be trusted.\n"
- "There is no need to restart EMQX to have the updated file loaded, because\n"
- "the system regularly checks if file has been updated (and reload).
\n"
- "NOTE: invalidating (deleting) a certificate from the file will not affect\n"
- "already established connections.\n"
+ desc => ?DESC(common_ssl_opts_schema_cacertfile)
}
)},
{"certfile",
@@ -1908,14 +1773,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("certfile"),
required => false,
- desc_id => common_ssl_opts_schema_certfile,
- desc =>
- "PEM format certificates chain file.
\n"
- "The certificates in this file should be in reversed order of the certificate\n"
- "issue chain. That is, the host's certificate should be placed in the beginning\n"
- "of the file, followed by the immediate issuer certificate and so on.\n"
- "Although the root CA certificate is optional, it should be placed at the end of\n"
- "the file if it is to be added."
+ desc => ?DESC(common_ssl_opts_schema_certfile)
}
)},
{"keyfile",
@@ -1924,9 +1782,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => D("keyfile"),
required => false,
- desc_id => common_ssl_opts_schema_keyfile,
- desc =>
- "PEM format private key file."
+ desc => ?DESC(common_ssl_opts_schema_keyfile)
}
)},
{"verify",
@@ -1934,9 +1790,7 @@ common_ssl_opts_schema(Defaults) ->
hoconsc:enum([verify_peer, verify_none]),
#{
default => Df("verify", verify_none),
- desc_id => common_ssl_opts_schema_verify,
- desc =>
- "Enable or disable peer verification."
+ desc => ?DESC(common_ssl_opts_schema_verify)
}
)},
{"reuse_sessions",
@@ -1944,9 +1798,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("reuse_sessions", true),
- desc_id => common_ssl_opts_schema_reuse_sessions,
- desc =>
- "Enable TLS session reuse."
+ desc => ?DESC(common_ssl_opts_schema_reuse_sessions)
}
)},
{"depth",
@@ -1954,13 +1806,7 @@ common_ssl_opts_schema(Defaults) ->
integer(),
#{
default => Df("depth", 10),
- desc_id => common_ssl_opts_schema_depth,
- desc =>
- "Maximum number of non-self-issued intermediate certificates that can follow "
- "the peer certificate in a valid certification path. "
- "So, if depth is 0 the PEER must be signed by the trusted ROOT-CA directly; "
- "if 1 the path can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, "
- "and so on. The default value is 10."
+ desc => ?DESC(common_ssl_opts_schema_depth)
}
)},
{"password",
@@ -1969,10 +1815,7 @@ common_ssl_opts_schema(Defaults) ->
#{
sensitive => true,
required => false,
- desc_id => common_ssl_opts_schema_password,
- desc =>
- "String containing the user's password. Only used if the private\n"
- "key file is password-protected."
+ desc => ?DESC(common_ssl_opts_schema_password)
}
)},
{"versions",
@@ -1980,12 +1823,7 @@ common_ssl_opts_schema(Defaults) ->
hoconsc:array(typerefl:atom()),
#{
default => default_tls_vsns(maps:get(versions, Defaults, tls_all_available)),
- desc_id => common_ssl_opts_schema_versions,
- desc =>
- "All TLS/DTLS versions to be supported.
\n"
- "NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config
\n"
- "In case PSK cipher suites are intended, make sure to configured\n"
- "['tlsv1.2', 'tlsv1.1']
here.",
+ desc => ?DESC(common_ssl_opts_schema_versions),
validator => fun validate_tls_versions/1
}
)},
@@ -1996,9 +1834,7 @@ common_ssl_opts_schema(Defaults) ->
#{
default => <<"emqx_tls_psk:lookup">>,
converter => fun ?MODULE:parse_user_lookup_fun/1,
- desc_id => common_ssl_opts_schema_user_lookup_fun,
- desc =>
- "EMQX-internal callback that is used to lookup pre-shared key (PSK) identity."
+ desc => ?DESC(common_ssl_opts_schema_user_lookup_fun)
}
)},
{"secure_renegotiate",
@@ -2006,12 +1842,7 @@ common_ssl_opts_schema(Defaults) ->
boolean(),
#{
default => Df("secure_renegotiate", true),
- desc_id => common_ssl_opts_schema_secure_renegotiate,
- desc =>
- "SSL parameter renegotiation is a feature that allows a client and a server\n"
- "to renegotiate the parameters of the SSL connection on the fly.\n"
- "RFC 5746 defines a more secure way of doing this. By enabling secure renegotiation,\n"
- "you drop support for the insecure renegotiation, prone to MitM attacks."
+ desc => ?DESC(common_ssl_opts_schema_secure_renegotiate)
}
)}
].
@@ -2036,13 +1867,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
#{
default => D("dhfile"),
required => false,
- desc_id => server_ssl_opts_schema_dhfile,
- desc =>
- "Path to a file containing PEM-encoded Diffie-Hellman parameters\n"
- "to be used by the server if a cipher suite using Diffie-Hellman\n"
- "key exchange is negotiated. If not specified, default parameters\n"
- "are used.
\n"
- "NOTE: The dhfile
option is not supported by TLS 1.3."
+ desc => ?DESC(server_ssl_opts_schema_dhfile)
}
)},
{"fail_if_no_peer_cert",
@@ -2050,13 +1875,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("fail_if_no_peer_cert", false),
- desc_id => server_ssl_opts_schema_fail_if_no_peer_cert,
- desc =>
- "Used together with {verify, verify_peer} by an TLS/DTLS server.\n"
- "If set to true, the server fails if the client does not have a\n"
- "certificate to send, that is, sends an empty certificate.\n"
- "If set to false, it fails only if the client sends an invalid\n"
- "certificate (an empty certificate is considered valid)."
+ desc => ?DESC(server_ssl_opts_schema_fail_if_no_peer_cert)
}
)},
{"honor_cipher_order",
@@ -2064,12 +1883,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("honor_cipher_order", true),
- desc_id => server_ssl_opts_schema_honor_cipher_order,
- desc =>
- "An important security setting, it forces the cipher to be set based\n"
- " on the server-specified order instead of the client-specified order,\n"
- " hence enforcing the (usually more properly configured) security\n"
- " ordering of the server administrator."
+ desc => ?DESC(server_ssl_opts_schema_honor_cipher_order)
}
)},
{"client_renegotiation",
@@ -2077,18 +1891,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
boolean(),
#{
default => Df("client_renegotiation", true),
- desc_id => server_ssl_opts_schema_client_renegotiation,
- desc =>
- "In protocols that support client-initiated renegotiation,\n"
- "the cost of resources of such an operation is higher for the "
- "server than the client.\n"
- "This can act as a vector for denial of service attacks.\n"
- "The SSL application already takes measures to counter-act such attempts,\n"
- "but client-initiated renegotiation can be strictly disabled by setting "
- "this option to false.\n"
- "The default value is true. Note that disabling renegotiation can result in\n"
- "long-lived connections becoming unusable due to limits on\n"
- "the number of messages the underlying cipher suite can encipher."
+ desc => ?DESC(server_ssl_opts_schema_client_renegotiation)
}
)}
| [
@@ -2097,8 +1900,7 @@ server_ssl_opts_schema(Defaults1, IsRanchListener) ->
duration(),
#{
default => Df("handshake_timeout", "15s"),
- desc_id => server_ssl_opts_schema_handshake_timeout,
- desc => "Maximum time duration allowed for the handshake to complete"
+ desc => ?DESC(server_ssl_opts_schema_handshake_timeout)
}
)}
|| IsRanchListener
@@ -2123,19 +1925,7 @@ client_ssl_opts_schema(Defaults1) ->
hoconsc:union([disable, string()]),
#{
required => false,
- desc_id => client_ssl_opts_schema_server_name_indication,
- desc =>
- "Specify the host name to be used in TLS Server Name Indication extension.
\n"
- "For instance, when connecting to \"server.example.net\", the genuine server\n"
- "which accepts the connection and performs TLS handshake may differ from the\n"
- "host the TLS client initially connects to, e.g. when connecting to an IP address\n"
- "or when the host has multiple resolvable DNS records
\n"
- "If not specified, it will default to the host name string which is used\n"
- "to establish the connection, unless it is IP addressed used.
\n"
- "The host name is then also used in the host name verification of the peer\n"
- "certificate.
The special value 'disable' prevents the Server Name\n"
- "Indication extension from being sent and disables the hostname\n"
- "verification check."
+ desc => ?DESC(client_ssl_opts_schema_server_name_indication)
}
)}
].
@@ -2164,8 +1954,11 @@ ciphers_schema(Default) ->
true -> undefined;
false -> fun validate_ciphers/1
end,
- desc_id => ciphers_schema_0,
- desc =>
+ desc_id => "ciphers_schema_" ++ case Default of
+ quic -> "quic";
+ _ -> "0"
+ end,
+ desc_en =>
"This config holds TLS cipher suite names separated by comma,\n"
"or as an array of strings. e.g.\n"
"\"TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256\"
or\n"
@@ -2246,7 +2039,6 @@ ref(Module, Field) -> hoconsc:ref(Module, Field).
mk_duration(Desc, OverrideMeta) ->
DefaultMeta = #{
- desc_id => mk_duration_0,
desc => Desc ++
" Time interval is a string that contains a number followed by time unit:
\n"
"- `ms` for milliseconds,\n"
From 52864e041337bb56d85fb5b33ab4c01cae31d8d8 Mon Sep 17 00:00:00 2001
From: Shawn <506895667@qq.com>
Date: Sat, 23 Apr 2022 17:48:03 +0800
Subject: [PATCH 4/6] docs: add Chinese doc for emqx schema
---
apps/emqx/i18n/emqx_schema_i18n.conf | 674 +++++++++++++++++----------
1 file changed, 434 insertions(+), 240 deletions(-)
diff --git a/apps/emqx/i18n/emqx_schema_i18n.conf b/apps/emqx/i18n/emqx_schema_i18n.conf
index f889ac547..1112fef09 100644
--- a/apps/emqx/i18n/emqx_schema_i18n.conf
+++ b/apps/emqx/i18n/emqx_schema_i18n.conf
@@ -1000,11 +1000,15 @@ or if no such user or client is found by the configurable authorization
sources such as built_in_database, an HTTP API, or a query against PostgreSQL.
Find more details in 'authorization.sources' config.
"""
- zh: """"""
+ zh: """
+如果用户或客户端不匹配ACL规则,或者从可配置授权源(比如内置数据库、HTTP API 或 PostgreSQL 等。)内未找
+到此类用户或客户端时,模式的认访问控制操作。
+在“授权”中查找更多详细信息。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Authorization no match"
+ zh: "未匹时的默认授权动作"
}
}
@@ -1013,11 +1017,13 @@ fields_authorization_deny_action {
en: """
The action when the authorization check rejects an operation.
"""
- zh: """"""
+ zh: """
+授权检查拒绝操作时的操作。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Authorization deny action"
+ zh: "授权检查拒绝操作时的操作"
}
}
@@ -1026,11 +1032,13 @@ fields_cache_enable {
en: """
Enable or disable the authorization cache.
"""
- zh: """"""
+ zh: """
+启用或禁用授权缓存。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Enable or disable the authorization cache."
+ zh: "启用或禁用授权缓存"
}
}
@@ -1039,11 +1047,13 @@ fields_cache_max_size {
en: """
Maximum number of cached items.
"""
- zh: """"""
+ zh: """
+缓存项的最大数量。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Maximum number of cached items."
+ zh: "缓存项的最大数量"
}
}
@@ -1052,11 +1062,13 @@ fields_cache_ttl {
en: """
Time to live for the cached data.
"""
- zh: """"""
+ zh: """
+缓存数据的生存时间。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Time to live for the cached data."
+ zh: "缓存数据的生存时间。"
}
}
@@ -1065,11 +1077,11 @@ fields_deflate_opts_level {
en: """
Compression level.
"""
- zh: """"""
+ zh: """压缩级别"""
}
label: {
- en: ""
- zh: ""
+ en: "Compression level"
+ zh: "压缩级别"
}
}
@@ -1077,13 +1089,16 @@ fields_deflate_opts_mem_level {
desc {
en: """
Specifies the size of the compression state.
- Lower values decrease memory usage per connection.
+Lower values decrease memory usage per connection.
+"""
+ zh: """
+指定压缩状态的大小
+较低的值会减少每个连接的内存使用。
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Size of the compression state"
+ zh: "压缩状态大小"
}
}
@@ -1092,39 +1107,41 @@ fields_deflate_opts_strategy {
en: """
Specifies the compression strategy.
"""
- zh: """"""
+ zh: """
+指定压缩策略。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "compression strategy"
+ zh: "指定压缩策略"
}
}
fields_deflate_opts_server_context_takeover {
desc {
en: """
-Takeover means the compression state is retained
- between server messages.
+Takeover means the compression state is retained between server messages.
"""
- zh: """"""
+ zh: """接管意味着在服务器消息之间保留压缩状态。"""
}
label: {
- en: ""
- zh: ""
+ en: "Server context takeover"
+ zh: "服务上下文接管"
}
}
fields_deflate_opts_client_context_takeover {
desc {
en: """
-Takeover means the compression state is retained
- between client messages.
+Takeover means the compression state is retained between client messages.
+"""
+ zh: """
+接管意味着在客户端消息之间保留压缩状态。
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Client context takeover"
+ zh: "客户端上下文接管"
}
}
@@ -1133,11 +1150,13 @@ fields_deflate_opts_server_max_window_bits {
en: """
Specifies the size of the compression context for the server.
"""
- zh: """"""
+ zh: """
+指定服务器压缩上下文的大小。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Server compression max window size"
+ zh: "服务器压缩窗口大小"
}
}
@@ -1146,11 +1165,13 @@ fields_deflate_opts_client_max_window_bits {
en: """
Specifies the size of the compression context for the client.
"""
- zh: """"""
+ zh: """
+指定客户端压缩上下文的大小。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Client compression max window size"
+ zh: "压缩窗口大小"
}
}
@@ -1159,11 +1180,11 @@ common_ssl_opts_schema_enable {
en: """
Enable TLS.
"""
- zh: """"""
+ zh: """启用 TLS"""
}
label: {
- en: ""
- zh: ""
+ en: "Enable TLS."
+ zh: "启用 TLS"
}
}
@@ -1177,13 +1198,18 @@ There is no need to restart EMQX to have the updated file loaded, because
the system regularly checks if file has been updated (and reload).
NOTE: invalidating (deleting) a certificate from the file will not affect
already established connections.
-
"""
- zh: """"""
+ zh: """
+受信任的PEM格式CA证书捆绑文件
+此文件中的证书用于验证TLS对等方的证书。
+如果要信任新CA,请将新证书附加到文件中。
+无需重启EMQX即可加载更新的文件,因为系统会定期检查文件是否已更新(并重新加载)
+注意:从文件中失效(删除)证书不会影响已建立的连接。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "CACertfile"
+ zh: "CA 证书文件"
}
}
@@ -1197,11 +1223,16 @@ of the file, followed by the immediate issuer certificate and so on.
Although the root CA certificate is optional, it should be placed at the end of
the file if it is to be added.
"""
- zh: """"""
+ zh: """
+PEM格式证书链文件
+此文件中的证书应与证书颁发链的顺序相反。也就是说,主机的证书应该放在文件的开头,然后是直接颁发者证书,依此类推。
+虽然根CA证书是可选的,但它应该放在
+如果要添加文件,请将其删除。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Certfile"
+ zh: "证书文件"
}
}
@@ -1210,11 +1241,13 @@ common_ssl_opts_schema_keyfile {
en: """
PEM format private key file.
"""
- zh: """"""
+ zh: """
+PEM格式的私钥文件。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Keyfile"
+ zh: "私钥文件"
}
}
@@ -1223,11 +1256,13 @@ common_ssl_opts_schema_verify {
en: """
Enable or disable peer verification.
"""
- zh: """"""
+ zh: """
+启用或禁用对等验证。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Verify peer"
+ zh: "对等验证"
}
}
@@ -1236,11 +1271,13 @@ common_ssl_opts_schema_reuse_sessions {
en: """
Enable TLS session reuse.
"""
- zh: """"""
+ zh: """
+启用 TLS 会话重用。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TLS session reuse"
+ zh: "TLS 会话重用"
}
}
@@ -1249,25 +1286,30 @@ common_ssl_opts_schema_depth {
en: """
Maximum number of non-self-issued intermediate certificates that can follow the peer certificate in a valid certification path. So, if depth is 0 the PEER must be signed by the trusted ROOT-CA directly; if 1 the path can be PEER, CA, ROOT-CA; if 2 the path can be PEER, CA, CA, ROOT-CA, and so on. The default value is 10.
"""
- zh: """"""
+ zh: """
+在有效的证书路径中,可以跟随对等证书的非自颁发中间证书的最大数量。因此,如果深度为0,则对等方必须由受信任的根CA直接签名;如果1,路径可以是PEER、CA、ROOT-CA;如果是2,则路径可以是PEER、CA、CA、ROOT-CA等等。默认值为10。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "CACert Depth"
+ zh: "CA 证书深度"
}
}
common_ssl_opts_schema_password {
desc {
en: """
-String containing the user's password. Only used if the private
-key file is password-protected.
+String containing the user's password.
+Only used if the private key file is password-protected.
+"""
+ zh: """
+包含用户密码的字符串。
+仅在私钥文件受密码保护时使用。
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Keyfile passphrase"
+ zh: "秘钥文件密码"
}
}
@@ -1275,15 +1317,20 @@ common_ssl_opts_schema_versions {
desc {
en: """
All TLS/DTLS versions to be supported.
-NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config
+NOTE: PSK ciphers are suppressed by 'tlsv1.3' version config.
In case PSK cipher suites are intended, make sure to configured
['tlsv1.2', 'tlsv1.1']
here.
"""
- zh: """"""
+ zh: """
+支持所有TLS/DTLS版本
+注:PSK密码被“tlsv1”抑制。3'版本配置
+如果打算使用PSK密码套件,请确保这里已配置
+['tlsv1.2','tlsv1.1']
。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL versions"
+ zh: "SSL 版本"
}
}
@@ -1317,9 +1364,33 @@ PSK cipher suites: "RSA-PSK-AES256-GCM-SHA384,RSA-PSK-AES256-CBC-SHA384,
RSA-PSK-AES128-GCM-SHA256,RSA-PSK-AES128-CBC-SHA256,
RSA-PSK-AES256-CBC-SHA,RSA-PSK-AES128-CBC-SHA,
RSA-PSK-DES-CBC3-SHA,RSA-PSK-RC4-SHA"
-
"""
- zh: """"""
+ zh: """
+此配置保存由逗号分隔的 TLS 密码套件名称,或作为字符串数组。例如
+“TLS_AES_256_GCM_SHA384,TLS_AES_128_GCM_SHA256”
或
+[“TLS_AES_256_GCM_SHA384”、“TLS_AES_128_GCM_SHA256”]
。
+
+密码(及其顺序)定义了客户端和服务器通过网络连接加密信息的方式。
+选择一个好的密码套件对于应用程序的数据安全性、机密性和性能至关重要。
+
+名称应为 OpenSSL 字符串格式(而不是 RFC 格式)。
+EMQX 配置文档提供的所有默认值和示例都是 OpenSSL 格式
+注意:某些密码套件仅与特定的 TLS 版本
兼容('tlsv1.1'、'tlsv1.2'或'tlsv1.3')。
+不兼容的密码套件将被自动删除。
+
+例如,如果只有“tlsv1.3”。在版本
中给出,为其他版本配置密码套件将无效。
+
+
+注:PSK密码被“tlsv1.3”抑制。版本配置
+如果打算使用PSK密码套件,“tlsv1.3”。应在版本
中禁用。
+
+
+PSK密码套件:
+"RSA-PSK-AES256-GCM-SHA384,RSA-PSK-AES256-CBC-SHA384,
+RSA-PSK-AES128-GCM-SHA256,RSA-PSK-AES128-CBC-SHA256,
+RSA-PSK-AES256-CBC-SHA,RSA-PSK-AES128-CBC-SHA,
+RSA-PSK-DES-CBC3-SHA,RSA-PSK-RC4-SHA"
+"""
}
label: {
en: ""
@@ -1332,11 +1403,13 @@ common_ssl_opts_schema_user_lookup_fun {
en: """
EMQX-internal callback that is used to lookup pre-shared key (PSK) identity.
"""
- zh: """"""
+ zh: """
+用于查找预共享密钥(PSK)标识的 EMQX 内部回调。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL PSK user lookup fun"
+ zh: "SSL PSK 用户回调"
}
}
@@ -1348,11 +1421,14 @@ to renegotiate the parameters of the SSL connection on the fly.
RFC 5746 defines a more secure way of doing this. By enabling secure renegotiation,
you drop support for the insecure renegotiation, prone to MitM attacks.
"""
- zh: """"""
+ zh: """
+SSL 参数重新协商是一种允许客户端和服务器动态重新协商 SSL 连接参数的功能。
+RFC 5746 定义了一种更安全的方法。通过启用安全的重新协商,您就失去了对不安全的重新协商的支持,从而容易受到 MitM 攻击。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL renegotiate"
+ zh: "SSL 重新协商"
}
}
@@ -1365,11 +1441,15 @@ key exchange is negotiated. If not specified, default parameters
are used.
NOTE: The dhfile
option is not supported by TLS 1.3.
"""
- zh: """"""
+ zh: """
+如果协商使用Diffie-Hellman密钥交换的密码套件,则服务器将使用包含PEM编码的Diffie-Hellman参数的文件的路径。如果未指定,则使用默认参数
+
+注意:TLS 1.3不支持dhfile
选项。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL dhfile"
+ zh: "SSL dhfile"
}
}
@@ -1382,11 +1462,15 @@ certificate to send, that is, sends an empty certificate.
If set to false, it fails only if the client sends an invalid
certificate (an empty certificate is considered valid).
"""
- zh: """"""
+ zh: """
+TLS/DTLS 服务器与 {verify,verify_peer} 一起使用。
+如果设置为true,则如果客户端没有要发送的证书,即发送空证书,服务器将失败。
+如果设置为false,则仅当客户端发送无效证书(空证书被视为有效证书)时才会失败。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL fail if no peer cert"
+ zh: "没有证书则 SSL 失败"
}
}
@@ -1398,11 +1482,13 @@ An important security setting, it forces the cipher to be set based
hence enforcing the (usually more properly configured) security
ordering of the server administrator.
"""
- zh: """"""
+ zh: """
+一个重要的安全设置,它强制根据服务器指定的顺序而不是客户机指定的顺序设置密码,从而强制服务器管理员执行(通常配置得更正确)安全顺序。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL honor cipher order"
+ zh: "SSL honor cipher order"
}
}
@@ -1418,11 +1504,16 @@ The default value is true. Note that disabling renegotiation can result in
long-lived connections becoming unusable due to limits on
the number of messages the underlying cipher suite can encipher.
"""
- zh: """"""
+ zh: """
+在支持客户机发起的重新协商的协议中,这种操作的资源成本对于服务器来说高于客户机。
+这可能会成为拒绝服务攻击的载体。
+SSL 应用程序已经采取措施来反击此类尝试,但通过将此选项设置为 false,可以严格禁用客户端发起的重新协商。
+默认值为 true。请注意,由于基础密码套件可以加密的消息数量有限,禁用重新协商可能会导致长期连接变得不可用。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL client renegotiation"
+ zh: "SSL 客户端冲协商"
}
}
@@ -1431,11 +1522,13 @@ server_ssl_opts_schema_handshake_timeout {
en: """
Maximum time duration allowed for the handshake to complete
"""
- zh: """"""
+ zh: """
+握手完成所允许的最长时间
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Handshake timeout"
+ zh: "握手超时时间"
}
}
@@ -1444,11 +1537,11 @@ fields_listeners_tcp {
en: """
TCP listeners
"""
- zh: """"""
+ zh: """TCP 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP listeners"
+ zh: "TCP 监听器"
}
}
@@ -1457,11 +1550,11 @@ fields_listeners_ssl {
en: """
SSL listeners
"""
- zh: """"""
+ zh: """SSL 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "SSL listeners"
+ zh: "SSL 监听器"
}
}
@@ -1470,11 +1563,11 @@ fields_listeners_ws {
en: """
HTTP websocket listeners
"""
- zh: """"""
+ zh: """HTTP websocket 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "HTTP websocket listeners"
+ zh: "HTTP websocket 监听器"
}
}
@@ -1483,11 +1576,11 @@ fields_listeners_wss {
en: """
HTTPS websocket listeners
"""
- zh: """"""
+ zh: """HTTPS websocket 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "HTTPS websocket listeners"
+ zh: "HTTPS websocket 监听器"
}
}
@@ -1496,11 +1589,11 @@ fields_listeners_quic {
en: """
QUIC listeners
"""
- zh: """"""
+ zh: """QUIC 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "QUIC listeners"
+ zh: "QUIC 监听器"
}
}
@@ -1509,11 +1602,11 @@ fields_mqtt_quic_listener_enabled {
en: """
Enable QUIC listener.
"""
- zh: """"""
+ zh: """启用 QUIC 监听器"""
}
label: {
- en: ""
- zh: ""
+ en: "Enable QUIC listener"
+ zh: "启用 QUIC 监听器"
}
}
@@ -1522,11 +1615,11 @@ fields_mqtt_quic_listener_certfile {
en: """
Path to the certificate file.
"""
- zh: """"""
+ zh: """证书文件"""
}
label: {
- en: ""
- zh: ""
+ en: "Certificate file"
+ zh: "证书文件"
}
}
@@ -1535,11 +1628,11 @@ fields_mqtt_quic_listener_keyfile {
en: """
Path to the secret key file.
"""
- zh: """"""
+ zh: """私钥文件"""
}
label: {
- en: ""
- zh: ""
+ en: "Key file"
+ zh: "私钥文件"
}
}
@@ -1549,11 +1642,13 @@ fields_mqtt_quic_listener_idle_timeout {
Close transport-layer connections from the clients that have not sent MQTT CONNECT
message within this interval.
"""
- zh: """"""
+ zh: """
+关闭在此间隔内未发送 MQTT CONNECT 消息的客户端的传输层连接。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Idle Timeout"
+ zh: "发呆超时时间"
}
}
@@ -1562,11 +1657,13 @@ base_listener_bind {
en: """
IP address and port for the listening socket.
"""
- zh: """"""
+ zh: """
+监听套接字的 IP 地址和端口。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "IP address and port"
+ zh: "IP 地址和端口"
}
}
@@ -1575,11 +1672,11 @@ base_listener_acceptors {
en: """
The size of the listener's receiving pool.
"""
- zh: """"""
+ zh: """监听器接收池的大小。"""
}
label: {
- en: ""
- zh: ""
+ en: "Acceptors Num"
+ zh: "接收器数量"
}
}
@@ -1588,11 +1685,13 @@ base_listener_max_connections {
en: """
The maximum number of concurrent connections allowed by the listener.
"""
- zh: """"""
+ zh: """
+监听器允许的最大并发连接数。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Max connections"
+ zh: "最大并发连接数"
}
}
@@ -1615,11 +1714,23 @@ When publishing or subscribing, prefix all topics with a mountpoint string.
- ${clientid}
: clientid
- ${username}
: username
"""
- zh: """"""
+ zh: """
+发布或订阅时,请在所有主题前面加上 mountpoint 字符串。
+
+将消息传递给订阅者时,将从主题名称中删除带前缀的字符串。挂载点是一种用户可以用来实现不同侦听器之间消息路由隔离的方法。
+
+例如,如果客户机a使用`侦听器订阅` t'。tcp<名称>。mountpoint`设置为'some_tenant',那么客户端实际上订阅了主题'some_tenant/t'。类似地,如果另一个客户端B(与客户端A连接到同一个侦听器)向主题“t”发送消息,该消息将路由到所有订阅了“some_租户/t”的客户端,因此客户端A将接收主题名为“t”的消息
+
+设置为“”“”以禁用该功能
+
+mountpoint 字符串中的变量:
+- ${clientid}
: clientid
+- ${username}
: username
+"""
}
label: {
- en: ""
- zh: ""
+ en: "mountpoint"
+ zh: "mountpoint"
}
}
@@ -1628,11 +1739,13 @@ base_listener_zone {
en: """
The configuration zone to which the listener belongs.
"""
- zh: """"""
+ zh: """
+监听器所属的配置组。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Zone"
+ zh: "配置组"
}
}
@@ -1641,11 +1754,13 @@ base_listener_limiter {
en: """
Type of the rate limit.
"""
- zh: """"""
+ zh: """
+速率限制类型
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Type of the rate limit."
+ zh: "速率限制类型"
}
}
@@ -1654,25 +1769,28 @@ mqtt_listener_access_rules {
en: """
The access control rules for this listener.
See: https://github.com/emqtt/esockd#allowdeny
"""
- zh: """"""
+ zh: """此监听器的访问控制规则。"""
}
label: {
- en: ""
- zh: ""
+ en: "Access rules"
+ zh: "访问控制规则"
}
}
mqtt_listener_proxy_protocol {
desc {
en: """
-Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed
- behind HAProxy or Nginx.
See: https://www.haproxy.com/blog/haproxy/proxy-protocol/
+Enable the Proxy Protocol V1/2 if the EMQX cluster is deployed behind HAProxy or Nginx.
+See: https://www.haproxy.com/blog/haproxy/proxy-protocol/
+"""
+ zh: """
+如果EMQX集群部署在 HAProxy 或 Nginx 之后,请启用代理协议 V1/2
+详情见: https://www.haproxy.com/blog/haproxy/proxy-protocol/
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Proxy protocol"
+ zh: "Proxy protocol"
}
}
@@ -1681,27 +1799,33 @@ mqtt_listener_proxy_protocol_timeout {
en: """
Timeout for proxy protocol. EMQX will close the TCP connection if proxy protocol packet is not received within the timeout.
"""
- zh: """"""
+ zh: """
+代理协议超时。如果在超时时间内未收到代理协议数据包,EMQX将关闭TCP连接。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Proxy protocol timeout"
+ zh: "Proxy protocol 超时时间"
}
}
authentication_0 {
desc {
en: """
-Per-listener authentication override
+Per-listener authentication override.
Authentication can be one single authenticator instance or a chain of authenticators as an array.
When authenticating a login (username, client ID, etc.) the authenticators are checked in the configured order.
"""
- zh: """"""
+ zh: """
+每侦听器身份验证覆盖。
+身份验证可以是单个身份验证程序实例,也可以是一个数组形式的身份验证程序链。
+验证登录名(用户名、客户端ID等)时,将按配置的顺序检查验证器
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Per-listener authentication override"
+ zh: "每个监听器的认证覆盖"
}
}
@@ -1710,11 +1834,13 @@ fields_rate_limit_max_conn_rate {
en: """
Maximum connections per second.
"""
- zh: """"""
+ zh: """
+每秒最大连接数。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Max connection rate"
+ zh: "每秒最大连接数"
}
}
@@ -1723,11 +1849,13 @@ fields_rate_limit_conn_messages_in {
en: """
Message limit for the external MQTT connections.
"""
- zh: """"""
+ zh: """
+外部 MQTT 连接的消息限制。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "connecting messages in"
+ zh: "外部 MQTT 连接的消息限制"
}
}
@@ -1737,11 +1865,14 @@ fields_rate_limit_conn_bytes_in {
Limit the rate of receiving packets for a MQTT connection.
The rate is counted by bytes of packets per second.
"""
- zh: """"""
+ zh: """
+限制 MQTT 连接接收数据包的速率。
+速率以每秒的数据包字节数计算。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Connection bytes in"
+ zh: "数据包速率"
}
}
@@ -1760,11 +1891,18 @@ certificate.
The special value 'disable' prevents the Server Name
Indication extension from being sent and disables the hostname
verification check.
"""
- zh: """"""
+ zh: """
+指定要在 TLS 服务器名称指示扩展中使用的主机名
+例如,当连接到“server.example.net”时,接受连接并执行TLS握手的真正服务器可能与TLS客户端最初连接到的主机不同,例如,当连接到IP地址时,或者当主机具有多个可解析的DNS记录时
+如果未指定,它将默认为使用的主机名字符串
+建立连接,除非使用IP地址
+然后,主机名也用于对等机的主机名验证
+证书
特殊值“disable”阻止发送服务器名称指示扩展,并禁用主机名验证检查。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Server Name Indication"
+ zh: "服务器名称指示"
}
}
@@ -1772,13 +1910,16 @@ fields_tcp_opts_active_n {
desc {
en: """
Specify the {active, N} option for this Socket.
- See: https://erlang.org/doc/man/inet.html#setopts-2
+See: https://erlang.org/doc/man/inet.html#setopts-2
+"""
+ zh: """
+为此套接字指定{active,N}选项
+See: https://erlang.org/doc/man/inet.html#setopts-2
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "active_n"
+ zh: "active_n"
}
}
@@ -1788,11 +1929,13 @@ fields_tcp_opts_backlog {
TCP backlog defines the maximum length that the queue of
pending connections can grow to.
"""
- zh: """"""
+ zh: """
+TCP backlog 定义了挂起连接队列可以增长到的最大长度。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP backlog length"
+ zh: "TCP 连接队列长度"
}
}
@@ -1801,11 +1944,13 @@ fields_tcp_opts_send_timeout {
en: """
The TCP send timeout for the connections.
"""
- zh: """"""
+ zh: """
+连接的TCP发送超时。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP send timeout"
+ zh: "TCP 发送超时"
}
}
@@ -1814,11 +1959,13 @@ fields_tcp_opts_send_timeout_close {
en: """
Close the connection if send timeout.
"""
- zh: """"""
+ zh: """
+如果发送超时,则关闭连接。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP send timeout close"
+ zh: "TCP 发送超时关闭连接"
}
}
@@ -1827,11 +1974,13 @@ fields_tcp_opts_recbuf {
en: """
The TCP receive buffer (OS kernel) for the connections.
"""
- zh: """"""
+ zh: """
+连接的 TCP 接收缓冲区(OS内核)。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP receive buffer"
+ zh: "TCP 接收缓冲区"
}
}
@@ -1840,11 +1989,13 @@ fields_tcp_opts_sndbuf {
en: """
The TCP send buffer (OS kernel) for the connections.
"""
- zh: """"""
+ zh: """
+连接的 TCP 发送缓冲区(OS内核)。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP send buffer"
+ zh: "TCP 发送缓冲区"
}
}
@@ -1853,11 +2004,13 @@ fields_tcp_opts_buffer {
en: """
The size of the user-space buffer used by the driver.
"""
- zh: """"""
+ zh: """
+驱动程序使用的用户空间缓冲区的大小。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP user-space buffer"
+ zh: "TCP 用户态缓冲区"
}
}
@@ -1867,10 +2020,12 @@ fields_tcp_opts_high_watermark {
The socket is set to a busy state when the amount of data queued internally
by the VM socket implementation reaches this limit.
"""
- zh: """"""
+ zh: """
+当 VM 套接字实现内部排队的数据量达到此限制时,套接字将设置为忙碌状态。
+"""
}
label: {
- en: ""
+ en: "TCP 高水位线"
zh: ""
}
}
@@ -1880,11 +2035,13 @@ fields_tcp_opts_nodelay {
en: """
The TCP_NODELAY flag for the connections.
"""
- zh: """"""
+ zh: """
+连接的 TCP_NODELAY 标识
+"""
}
label: {
- en: ""
- zh: ""
+ en: "TCP_NODELAY"
+ zh: "TCP_NODELAY"
}
}
@@ -1893,11 +2050,13 @@ fields_tcp_opts_reuseaddr {
en: """
The SO_REUSEADDR flag for the connections.
"""
- zh: """"""
+ zh: """
+连接的 SO_REUSEADDR 标识
+"""
}
label: {
- en: ""
- zh: ""
+ en: "SO_REUSEADDR"
+ zh: "SO_REUSEADDR"
}
}
@@ -1911,25 +2070,34 @@ Determine the format of the payload format in the trace file.
`hidden`: payload is obfuscated as `******`
"""
- zh: """"""
+ zh: """
+确定跟踪文件中有效负载格式的格式
+`text`:基于文本的协议或纯文本协议。
+建议在有效负载为JSON编码时使用
+`hex`:二进制十六进制编码。当有效负载是自定义二进制协议时,建议使用此选项
+`hidden`:有效负载被模糊化为 `******`
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Payload encode"
+ zh: "有效负载编码"
}
}
fields_ws_opts_mqtt_path {
desc {
en: """
-WebSocket's MQTT protocol path. So the address of
- EMQX Broker's WebSocket is: ws://{ip}:{port}/mqtt
+WebSocket's MQTT protocol path. So the address of EMQX Broker's WebSocket is:
+ws://{ip}:{port}/mqtt
+"""
+ zh: """
+WebSocket 的 MQTT 协议路径。因此,EMQX Broker的WebSocket地址为:
+ws://{ip}:{port}/mqtt
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "WS MQTT Path"
+ zh: "WS MQTT 路径"
}
}
@@ -1938,11 +2106,13 @@ fields_ws_opts_mqtt_piggyback {
en: """
Whether a WebSocket message is allowed to contain multiple MQTT packets.
"""
- zh: """"""
+ zh: """
+WebSocket消息是否允许包含多个 MQTT 数据包。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "MQTT Piggyback"
+ zh: "MQTT Piggyback"
}
}
@@ -1952,11 +2122,14 @@ fields_ws_opts_compress {
If true
, compress WebSocket messages using zlib
.
The configuration items under deflate_opts
belong to the compression-related parameter configuration.
"""
- zh: """"""
+ zh: """
+如果 true
,则使用zlib
压缩 WebSocket 消息
+deflate_opts
下的配置项属于压缩相关参数配置。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Ws compress"
+ zh: "Ws 压缩"
}
}
@@ -1966,11 +2139,13 @@ fields_ws_opts_idle_timeout {
Close transport-layer connections from the clients that have not sent MQTT CONNECT
message within this interval.
"""
- zh: """"""
+ zh: """
+关闭在此间隔内未发送 MQTT CONNECT 消息的客户端的传输层连接。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "WS idle timeout"
+ zh: "WS 发呆时间"
}
}
@@ -1979,11 +2154,13 @@ fields_ws_opts_max_frame_size {
en: """
The maximum length of a single MQTT packet.
"""
- zh: """"""
+ zh: """
+单个 MQTT 数据包的最大长度。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Max frame size"
+ zh: "最大数据包长度"
}
}
@@ -1994,11 +2171,14 @@ If true
, the server will return an error when
the client does not carry the Sec-WebSocket-Protocol
field.
Note: WeChat applet needs to disable this verification.
"""
- zh: """"""
+ zh: """
+如果true
,当客户端未携带Sec WebSocket Protocol
字段时,服务器将返回一个错误。
+
注意:微信小程序需要禁用此验证。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Fail if no subprotocol"
+ zh: "无 subprotocol 则失败"
}
}
@@ -2007,11 +2187,13 @@ fields_ws_opts_supported_subprotocols {
en: """
Comma-separated list of supported subprotocols.
"""
- zh: """"""
+ zh: """
+逗号分隔的 subprotocols 支持列表。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Supported subprotocols"
+ zh: "Subprotocols 支持列表"
}
}
@@ -2022,11 +2204,13 @@ If true
, origin
HTTP header will be
validated against the list of allowed origins configured in check_origins
parameter.
"""
- zh: """"""
+ zh: """
+如果true
,origin
HTTP 头将根据check_origins
参数中配置的允许来源列表进行验证。
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Check origin"
+ zh: "检查 origin"
}
}
@@ -2037,11 +2221,13 @@ If false
and check_origin_enable
is
true
, the server will reject requests that don't have origin
HTTP header.
"""
- zh: """"""
+ zh: """
+If false
and check_origin_enable
is true
, the server will reject requests that don't have origin
HTTP header.
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Allow origin absence"
+ zh: "允许 origin 缺失"
}
}
@@ -2050,11 +2236,13 @@ fields_ws_opts_check_origins {
en: """
List of allowed origins.
See check_origin_enable
.
"""
- zh: """"""
+ zh: """
+允许的 origins 列表
+"""
}
label: {
- en: ""
- zh: ""
+ en: "Allowed origins"
+ zh: "允许的 origins"
}
}
@@ -2062,13 +2250,16 @@ fields_ws_opts_proxy_address_header {
desc {
en: """
HTTP header used to pass information about the client IP address.
- Relevant when the EMQX cluster is deployed behind a load-balancer.
+Relevant when the EMQX cluster is deployed behind a load-balancer.
+"""
+ zh: """
+HTTP 头,用于传递有关客户端 IP 地址的信息。
+当 EMQX 集群部署在负载平衡器后面时,这一点非常重要。
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Proxy address header"
+ zh: "客户端地址头"
}
}
@@ -2076,13 +2267,16 @@ fields_ws_opts_proxy_port_header {
desc {
en: """
HTTP header used to pass information about the client port.
- Relevant when the EMQX cluster is deployed behind a load-balancer.
+Relevant when the EMQX cluster is deployed behind a load-balancer.
+"""
+ zh: """
+HTTP 头,用于传递有关客户端端口的信息。
+当 EMQX 集群部署在负载平衡器后面时,这一点非常重要。
"""
- zh: """"""
}
label: {
- en: ""
- zh: ""
+ en: "Proxy port header"
+ zh: "客户端端口头"
}
}
From 9080b19440513e8462185e9102b11b8eb811bf99 Mon Sep 17 00:00:00 2001
From: Shawn <506895667@qq.com>
Date: Sun, 24 Apr 2022 09:54:35 +0800
Subject: [PATCH 5/6] fix: update exhook schema for user_lookup_fun
---
apps/emqx_exhook/src/emqx_exhook_schema.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/emqx_exhook/src/emqx_exhook_schema.erl b/apps/emqx_exhook/src/emqx_exhook_schema.erl
index f865faef4..9e40e8507 100644
--- a/apps/emqx_exhook/src/emqx_exhook_schema.erl
+++ b/apps/emqx_exhook/src/emqx_exhook_schema.erl
@@ -100,7 +100,7 @@ fields(server) ->
];
fields(ssl_conf) ->
Schema = emqx_schema:client_ssl_opts_schema(#{}),
- lists:keydelete(user_lookup_fun, 1, Schema).
+ lists:keydelete("user_lookup_fun", 1, Schema).
desc(exhook) ->
"External hook (exhook) configuration.";
From a77bb994e120fe6aa8d26427a6a4c37b219da0ff Mon Sep 17 00:00:00 2001
From: Zhongwen Deng
Date: Sun, 24 Apr 2022 11:52:06 +0800
Subject: [PATCH 6/6] fix: add timeout for schema json gen test
---
apps/emqx/src/emqx_schema.erl | 38 +++++++++----------
.../emqx_conf/test/emqx_conf_schema_tests.erl | 24 +++++++++---
.../emqx_enterprise_conf_schema_tests.erl | 24 +++++++++---
3 files changed, 55 insertions(+), 31 deletions(-)
diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl
index ff95414f8..7e72f52df 100644
--- a/apps/emqx/src/emqx_schema.erl
+++ b/apps/emqx/src/emqx_schema.erl
@@ -841,30 +841,30 @@ fields("mqtt_quic_listener") ->
{"enabled",
sc(
boolean(),
- #{ default => true
- , desc => ?DESC(fields_mqtt_quic_listener_enabled)
- }
+ #{
+ default => true,
+ desc => ?DESC(fields_mqtt_quic_listener_enabled)
+ }
)},
%% TODO: ensure cacertfile is configurable
{"certfile",
sc(
string(),
- #{ desc => ?DESC(fields_mqtt_quic_listener_certfile)
- }
+ #{desc => ?DESC(fields_mqtt_quic_listener_certfile)}
)},
{"keyfile",
sc(
string(),
- #{ desc => ?DESC(fields_mqtt_quic_listener_keyfile)
- }
+ #{desc => ?DESC(fields_mqtt_quic_listener_keyfile)}
)},
{"ciphers", ciphers_schema(quic)},
{"idle_timeout",
sc(
duration(),
- #{ default => "15s"
- , desc => ?DESC(fields_mqtt_quic_listener_idle_timeout)
- }
+ #{
+ default => "15s",
+ desc => ?DESC(fields_mqtt_quic_listener_idle_timeout)
+ }
)}
] ++ base_listener();
fields("ws_opts") ->
@@ -1008,20 +1008,17 @@ fields("tcp_opts") ->
{"recbuf",
sc(
bytesize(),
- #{ desc => ?DESC(fields_tcp_opts_recbuf)
- }
+ #{desc => ?DESC(fields_tcp_opts_recbuf)}
)},
{"sndbuf",
sc(
bytesize(),
- #{ desc => ?DESC(fields_tcp_opts_sndbuf)
- }
+ #{desc => ?DESC(fields_tcp_opts_sndbuf)}
)},
{"buffer",
sc(
bytesize(),
- #{ desc => ?DESC(fields_tcp_opts_buffer)
- }
+ #{desc => ?DESC(fields_tcp_opts_buffer)}
)},
{"high_watermark",
sc(
@@ -1075,8 +1072,7 @@ fields("deflate_opts") ->
{"level",
sc(
hoconsc:enum([none, default, best_compression, best_speed]),
- #{ desc => ?DESC(fields_deflate_opts_level)
- }
+ #{desc => ?DESC(fields_deflate_opts_level)}
)},
{"mem_level",
sc(
@@ -1089,8 +1085,7 @@ fields("deflate_opts") ->
{"strategy",
sc(
hoconsc:enum([default, filtered, huffman_only, rle]),
- #{ desc => ?DESC(fields_deflate_opts_strategy)
- }
+ #{desc => ?DESC(fields_deflate_opts_strategy)}
)},
{"server_context_takeover",
sc(
@@ -1954,7 +1949,8 @@ ciphers_schema(Default) ->
true -> undefined;
false -> fun validate_ciphers/1
end,
- desc_id => "ciphers_schema_" ++ case Default of
+ desc_id => "ciphers_schema_" ++
+ case Default of
quic -> "quic";
_ -> "0"
end,
diff --git a/apps/emqx_conf/test/emqx_conf_schema_tests.erl b/apps/emqx_conf/test/emqx_conf_schema_tests.erl
index b222a49ae..af70d2a94 100644
--- a/apps/emqx_conf/test/emqx_conf_schema_tests.erl
+++ b/apps/emqx_conf/test/emqx_conf_schema_tests.erl
@@ -7,8 +7,22 @@
-include_lib("eunit/include/eunit.hrl").
doc_gen_test() ->
- Dir = "tmp",
- ok = filelib:ensure_dir(filename:join("tmp", foo)),
- I18nFile = filename:join(["_build", "test", "lib", "emqx_dashboard", "etc", "i18n.conf.all"]),
- _ = emqx_conf:dump_schema(Dir, emqx_conf_schema, I18nFile),
- ok.
+ %% the json file too large to encode.
+ {
+ timeout,
+ 60,
+ fun() ->
+ Dir = "tmp",
+ ok = filelib:ensure_dir(filename:join("tmp", foo)),
+ I18nFile = filename:join([
+ "_build",
+ "test",
+ "lib",
+ "emqx_dashboard",
+ "etc",
+ "i18n.conf.all"
+ ]),
+ _ = emqx_conf:dump_schema(Dir, emqx_conf_schema, I18nFile),
+ ok
+ end
+ }.
diff --git a/lib-ee/emqx_enterprise_conf/test/emqx_enterprise_conf_schema_tests.erl b/lib-ee/emqx_enterprise_conf/test/emqx_enterprise_conf_schema_tests.erl
index 10c5998db..94d180377 100644
--- a/lib-ee/emqx_enterprise_conf/test/emqx_enterprise_conf_schema_tests.erl
+++ b/lib-ee/emqx_enterprise_conf/test/emqx_enterprise_conf_schema_tests.erl
@@ -7,8 +7,22 @@
-include_lib("eunit/include/eunit.hrl").
doc_gen_test() ->
- Dir = "tmp",
- ok = filelib:ensure_dir(filename:join("tmp", foo)),
- I18nFile = filename:join(["_build", "test", "lib", "emqx_dashboard", "etc", "i18n.conf.all"]),
- _ = emqx_conf:dump_schema(Dir, emqx_enterprise_conf_schema, I18nFile),
- ok.
+ %% the json file too large to encode.
+ {
+ timeout,
+ 60,
+ fun() ->
+ Dir = "tmp",
+ ok = filelib:ensure_dir(filename:join("tmp", foo)),
+ I18nFile = filename:join([
+ "_build",
+ "test",
+ "lib",
+ "emqx_dashboard",
+ "etc",
+ "i18n.conf.all"
+ ]),
+ _ = emqx_conf:dump_schema(Dir, emqx_enterprise_conf_schema, I18nFile),
+ ok
+ end
+ }.