fix(schema): binary string for default values

A lot of the string value fields had default value defined in
schema as list-string rather than binary-string.
This caused the generated schema dump (in JSON format)
to have raw_default field as an integer array.
This commit is contained in:
Zaiming (Stone) Shi 2023-02-18 13:09:03 +01:00
parent 53ecfb98d0
commit 9316690c29
30 changed files with 151 additions and 151 deletions

View File

@ -110,11 +110,11 @@ fields(limiter) ->
]; ];
fields(node_opts) -> fields(node_opts) ->
[ [
{rate, ?HOCON(rate(), #{desc => ?DESC(rate), default => "infinity"})}, {rate, ?HOCON(rate(), #{desc => ?DESC(rate), default => <<"infinity">>})},
{burst, {burst,
?HOCON(burst_rate(), #{ ?HOCON(burst_rate(), #{
desc => ?DESC(burst), desc => ?DESC(burst),
default => 0 default => <<"0">>
})} })}
]; ];
fields(client_fields) -> fields(client_fields) ->
@ -128,14 +128,14 @@ fields(client_fields) ->
]; ];
fields(bucket_opts) -> fields(bucket_opts) ->
[ [
{rate, ?HOCON(rate(), #{desc => ?DESC(rate), default => "infinity"})}, {rate, ?HOCON(rate(), #{desc => ?DESC(rate), default => <<"infinity">>})},
{capacity, ?HOCON(capacity(), #{desc => ?DESC(capacity), default => "infinity"})}, {capacity, ?HOCON(capacity(), #{desc => ?DESC(capacity), default => <<"infinity">>})},
{initial, ?HOCON(initial(), #{default => "0", desc => ?DESC(initial)})} {initial, ?HOCON(initial(), #{default => <<"0">>, desc => ?DESC(initial)})}
]; ];
fields(client_opts) -> fields(client_opts) ->
[ [
{rate, ?HOCON(rate(), #{default => "infinity", desc => ?DESC(rate)})}, {rate, ?HOCON(rate(), #{default => <<"infinity">>, desc => ?DESC(rate)})},
{initial, ?HOCON(initial(), #{default => "0", desc => ?DESC(initial)})}, {initial, ?HOCON(initial(), #{default => <<"0">>, desc => ?DESC(initial)})},
%% low_watermark add for emqx_channel and emqx_session %% low_watermark add for emqx_channel and emqx_session
%% both modules consume first and then check %% both modules consume first and then check
%% so we need to use this value to prevent excessive consumption %% so we need to use this value to prevent excessive consumption
@ -145,13 +145,13 @@ fields(client_opts) ->
initial(), initial(),
#{ #{
desc => ?DESC(low_watermark), desc => ?DESC(low_watermark),
default => "0" default => <<"0">>
} }
)}, )},
{capacity, {capacity,
?HOCON(capacity(), #{ ?HOCON(capacity(), #{
desc => ?DESC(client_bucket_capacity), desc => ?DESC(client_bucket_capacity),
default => "infinity" default => <<"infinity">>
})}, })},
{divisible, {divisible,
?HOCON( ?HOCON(
@ -166,7 +166,7 @@ fields(client_opts) ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
desc => ?DESC(max_retry_time), desc => ?DESC(max_retry_time),
default => "10s" default => <<"10s">>
} }
)}, )},
{failure_strategy, {failure_strategy,

View File

@ -268,7 +268,7 @@ fields("persistent_session_store") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1h", default => <<"1h">>,
desc => ?DESC(persistent_session_store_max_retain_undelivered) desc => ?DESC(persistent_session_store_max_retain_undelivered)
} }
)}, )},
@ -276,7 +276,7 @@ fields("persistent_session_store") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1h", default => <<"1h">>,
desc => ?DESC(persistent_session_store_message_gc_interval) desc => ?DESC(persistent_session_store_message_gc_interval)
} }
)}, )},
@ -284,7 +284,7 @@ fields("persistent_session_store") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1m", default => <<"1m">>,
desc => ?DESC(persistent_session_store_session_message_gc_interval) desc => ?DESC(persistent_session_store_session_message_gc_interval)
} }
)} )}
@ -352,7 +352,7 @@ fields("authz_cache") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1m", default => <<"1m">>,
desc => ?DESC(fields_cache_ttl) desc => ?DESC(fields_cache_ttl)
} }
)} )}
@ -363,7 +363,7 @@ fields("mqtt") ->
sc( sc(
hoconsc:union([infinity, duration()]), hoconsc:union([infinity, duration()]),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC(mqtt_idle_timeout) desc => ?DESC(mqtt_idle_timeout)
} }
)}, )},
@ -371,7 +371,7 @@ fields("mqtt") ->
sc( sc(
bytesize(), bytesize(),
#{ #{
default => "1MB", default => <<"1MB">>,
desc => ?DESC(mqtt_max_packet_size) desc => ?DESC(mqtt_max_packet_size)
} }
)}, )},
@ -507,7 +507,7 @@ fields("mqtt") ->
sc( sc(
duration(), duration(),
#{ #{
default => "30s", default => <<"30s">>,
desc => ?DESC(mqtt_retry_interval) desc => ?DESC(mqtt_retry_interval)
} }
)}, )},
@ -523,7 +523,7 @@ fields("mqtt") ->
sc( sc(
duration(), duration(),
#{ #{
default => "300s", default => <<"300s">>,
desc => ?DESC(mqtt_await_rel_timeout) desc => ?DESC(mqtt_await_rel_timeout)
} }
)}, )},
@ -531,7 +531,7 @@ fields("mqtt") ->
sc( sc(
duration(), duration(),
#{ #{
default => "2h", default => <<"2h">>,
desc => ?DESC(mqtt_session_expiry_interval) desc => ?DESC(mqtt_session_expiry_interval)
} }
)}, )},
@ -617,7 +617,7 @@ fields("flapping_detect") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1m", default => <<"1m">>,
desc => ?DESC(flapping_detect_window_time) desc => ?DESC(flapping_detect_window_time)
} }
)}, )},
@ -625,7 +625,7 @@ fields("flapping_detect") ->
sc( sc(
duration(), duration(),
#{ #{
default => "5m", default => <<"5m">>,
desc => ?DESC(flapping_detect_ban_time) desc => ?DESC(flapping_detect_ban_time)
} }
)} )}
@ -652,7 +652,7 @@ fields("force_shutdown") ->
sc( sc(
wordsize(), wordsize(),
#{ #{
default => "32MB", default => <<"32MB">>,
desc => ?DESC(force_shutdown_max_heap_size), desc => ?DESC(force_shutdown_max_heap_size),
validator => fun ?MODULE:validate_heap_size/1 validator => fun ?MODULE:validate_heap_size/1
} }
@ -715,7 +715,7 @@ fields("conn_congestion") ->
sc( sc(
duration(), duration(),
#{ #{
default => "1m", default => <<"1m">>,
desc => ?DESC(conn_congestion_min_alarm_sustain_duration) desc => ?DESC(conn_congestion_min_alarm_sustain_duration)
} }
)} )}
@ -739,7 +739,7 @@ fields("force_gc") ->
sc( sc(
bytesize(), bytesize(),
#{ #{
default => "16MB", default => <<"16MB">>,
desc => ?DESC(force_gc_bytes) desc => ?DESC(force_gc_bytes)
} }
)} )}
@ -874,7 +874,7 @@ fields("mqtt_quic_listener") ->
sc( sc(
duration_ms(), duration_ms(),
#{ #{
default => "10s", default => <<"10s">>,
desc => ?DESC(fields_mqtt_quic_listener_handshake_idle_timeout) desc => ?DESC(fields_mqtt_quic_listener_handshake_idle_timeout)
} }
)}, )},
@ -901,7 +901,7 @@ fields("ws_opts") ->
sc( sc(
string(), string(),
#{ #{
default => "/mqtt", default => <<"/mqtt">>,
desc => ?DESC(fields_ws_opts_mqtt_path) desc => ?DESC(fields_ws_opts_mqtt_path)
} }
)}, )},
@ -925,7 +925,7 @@ fields("ws_opts") ->
sc( sc(
duration(), duration(),
#{ #{
default => "7200s", default => <<"7200s">>,
desc => ?DESC(fields_ws_opts_idle_timeout) desc => ?DESC(fields_ws_opts_idle_timeout)
} }
)}, )},
@ -949,7 +949,7 @@ fields("ws_opts") ->
sc( sc(
comma_separated_list(), comma_separated_list(),
#{ #{
default => "mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5", default => <<"mqtt, mqtt-v3, mqtt-v3.1.1, mqtt-v5">>,
desc => ?DESC(fields_ws_opts_supported_subprotocols) desc => ?DESC(fields_ws_opts_supported_subprotocols)
} }
)}, )},
@ -981,7 +981,7 @@ fields("ws_opts") ->
sc( sc(
string(), string(),
#{ #{
default => "x-forwarded-for", default => <<"x-forwarded-for">>,
desc => ?DESC(fields_ws_opts_proxy_address_header) desc => ?DESC(fields_ws_opts_proxy_address_header)
} }
)}, )},
@ -989,7 +989,7 @@ fields("ws_opts") ->
sc( sc(
string(), string(),
#{ #{
default => "x-forwarded-port", default => <<"x-forwarded-port">>,
desc => ?DESC(fields_ws_opts_proxy_port_header) desc => ?DESC(fields_ws_opts_proxy_port_header)
} }
)}, )},
@ -1021,7 +1021,7 @@ fields("tcp_opts") ->
sc( sc(
duration(), duration(),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC(fields_tcp_opts_send_timeout) desc => ?DESC(fields_tcp_opts_send_timeout)
} }
)}, )},
@ -1062,7 +1062,7 @@ fields("tcp_opts") ->
sc( sc(
bytesize(), bytesize(),
#{ #{
default => "1MB", default => <<"1MB">>,
desc => ?DESC(fields_tcp_opts_high_watermark) desc => ?DESC(fields_tcp_opts_high_watermark)
} }
)}, )},
@ -1275,7 +1275,7 @@ fields("sys_topics") ->
sc( sc(
hoconsc:union([disabled, duration()]), hoconsc:union([disabled, duration()]),
#{ #{
default => "1m", default => <<"1m">>,
desc => ?DESC(sys_msg_interval) desc => ?DESC(sys_msg_interval)
} }
)}, )},
@ -1283,7 +1283,7 @@ fields("sys_topics") ->
sc( sc(
hoconsc:union([disabled, duration()]), hoconsc:union([disabled, duration()]),
#{ #{
default => "30s", default => <<"30s">>,
desc => ?DESC(sys_heartbeat_interval) desc => ?DESC(sys_heartbeat_interval)
} }
)}, )},
@ -1352,7 +1352,7 @@ fields("sysmon_vm") ->
sc( sc(
duration(), duration(),
#{ #{
default => "30s", default => <<"30s">>,
desc => ?DESC(sysmon_vm_process_check_interval) desc => ?DESC(sysmon_vm_process_check_interval)
} }
)}, )},
@ -1360,7 +1360,7 @@ fields("sysmon_vm") ->
sc( sc(
percent(), percent(),
#{ #{
default => "80%", default => <<"80%">>,
desc => ?DESC(sysmon_vm_process_high_watermark) desc => ?DESC(sysmon_vm_process_high_watermark)
} }
)}, )},
@ -1368,7 +1368,7 @@ fields("sysmon_vm") ->
sc( sc(
percent(), percent(),
#{ #{
default => "60%", default => <<"60%">>,
desc => ?DESC(sysmon_vm_process_low_watermark) desc => ?DESC(sysmon_vm_process_low_watermark)
} }
)}, )},
@ -1384,7 +1384,7 @@ fields("sysmon_vm") ->
sc( sc(
hoconsc:union([disabled, duration()]), hoconsc:union([disabled, duration()]),
#{ #{
default => "240ms", default => <<"240ms">>,
desc => ?DESC(sysmon_vm_long_schedule) desc => ?DESC(sysmon_vm_long_schedule)
} }
)}, )},
@ -1392,7 +1392,7 @@ fields("sysmon_vm") ->
sc( sc(
hoconsc:union([disabled, bytesize()]), hoconsc:union([disabled, bytesize()]),
#{ #{
default => "32MB", default => <<"32MB">>,
desc => ?DESC(sysmon_vm_large_heap) desc => ?DESC(sysmon_vm_large_heap)
} }
)}, )},
@ -1419,7 +1419,7 @@ fields("sysmon_os") ->
sc( sc(
duration(), duration(),
#{ #{
default => "60s", default => <<"60s">>,
desc => ?DESC(sysmon_os_cpu_check_interval) desc => ?DESC(sysmon_os_cpu_check_interval)
} }
)}, )},
@ -1427,7 +1427,7 @@ fields("sysmon_os") ->
sc( sc(
percent(), percent(),
#{ #{
default => "80%", default => <<"80%">>,
desc => ?DESC(sysmon_os_cpu_high_watermark) desc => ?DESC(sysmon_os_cpu_high_watermark)
} }
)}, )},
@ -1435,7 +1435,7 @@ fields("sysmon_os") ->
sc( sc(
percent(), percent(),
#{ #{
default => "60%", default => <<"60%">>,
desc => ?DESC(sysmon_os_cpu_low_watermark) desc => ?DESC(sysmon_os_cpu_low_watermark)
} }
)}, )},
@ -1443,7 +1443,7 @@ fields("sysmon_os") ->
sc( sc(
hoconsc:union([disabled, duration()]), hoconsc:union([disabled, duration()]),
#{ #{
default => "60s", default => <<"60s">>,
desc => ?DESC(sysmon_os_mem_check_interval) desc => ?DESC(sysmon_os_mem_check_interval)
} }
)}, )},
@ -1451,7 +1451,7 @@ fields("sysmon_os") ->
sc( sc(
percent(), percent(),
#{ #{
default => "70%", default => <<"70%">>,
desc => ?DESC(sysmon_os_sysmem_high_watermark) desc => ?DESC(sysmon_os_sysmem_high_watermark)
} }
)}, )},
@ -1459,7 +1459,7 @@ fields("sysmon_os") ->
sc( sc(
percent(), percent(),
#{ #{
default => "5%", default => <<"5%">>,
desc => ?DESC(sysmon_os_procmem_high_watermark) desc => ?DESC(sysmon_os_procmem_high_watermark)
} }
)} )}
@ -1480,7 +1480,7 @@ fields("sysmon_top") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "system_monitor.top_sample_interval", mapping => "system_monitor.top_sample_interval",
default => "2s", default => <<"2s">>,
desc => ?DESC(sysmon_top_sample_interval) desc => ?DESC(sysmon_top_sample_interval)
} }
)}, )},
@ -1499,7 +1499,7 @@ fields("sysmon_top") ->
#{ #{
mapping => "system_monitor.db_hostname", mapping => "system_monitor.db_hostname",
desc => ?DESC(sysmon_top_db_hostname), desc => ?DESC(sysmon_top_db_hostname),
default => "" default => <<>>
} }
)}, )},
{"db_port", {"db_port",
@ -1516,7 +1516,7 @@ fields("sysmon_top") ->
string(), string(),
#{ #{
mapping => "system_monitor.db_username", mapping => "system_monitor.db_username",
default => "system_monitor", default => <<"system_monitor">>,
desc => ?DESC(sysmon_top_db_username) desc => ?DESC(sysmon_top_db_username)
} }
)}, )},
@ -1525,7 +1525,7 @@ fields("sysmon_top") ->
binary(), binary(),
#{ #{
mapping => "system_monitor.db_password", mapping => "system_monitor.db_password",
default => "system_monitor_password", default => <<"system_monitor_password">>,
desc => ?DESC(sysmon_top_db_password), desc => ?DESC(sysmon_top_db_password),
converter => fun password_converter/2, converter => fun password_converter/2,
sensitive => true sensitive => true
@ -1536,7 +1536,7 @@ fields("sysmon_top") ->
string(), string(),
#{ #{
mapping => "system_monitor.db_name", mapping => "system_monitor.db_name",
default => "postgres", default => <<"postgres">>,
desc => ?DESC(sysmon_top_db_name) desc => ?DESC(sysmon_top_db_name)
} }
)} )}
@ -1566,7 +1566,7 @@ fields("alarm") ->
sc( sc(
duration(), duration(),
#{ #{
default => "24h", default => <<"24h">>,
example => "24h", example => "24h",
desc => ?DESC(alarm_validity_period) desc => ?DESC(alarm_validity_period)
} }
@ -1605,7 +1605,7 @@ mqtt_listener(Bind) ->
duration(), duration(),
#{ #{
desc => ?DESC(mqtt_listener_proxy_protocol_timeout), desc => ?DESC(mqtt_listener_proxy_protocol_timeout),
default => "3s" default => <<"3s">>
} }
)}, )},
{?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME, authentication(listener)} {?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME, authentication(listener)}
@ -1956,7 +1956,7 @@ common_ssl_opts_schema(Defaults) ->
sc( sc(
duration(), duration(),
#{ #{
default => Df("hibernate_after", "5s"), default => Df("hibernate_after", <<"5s">>),
desc => ?DESC(common_ssl_opts_schema_hibernate_after) desc => ?DESC(common_ssl_opts_schema_hibernate_after)
} }
)} )}
@ -2006,7 +2006,7 @@ server_ssl_opts_schema(Defaults, IsRanchListener) ->
sc( sc(
duration(), duration(),
#{ #{
default => Df("handshake_timeout", "15s"), default => Df("handshake_timeout", <<"15s">>),
desc => ?DESC(server_ssl_opts_schema_handshake_timeout) desc => ?DESC(server_ssl_opts_schema_handshake_timeout)
} }
)} )}

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{application, emqx_authn, [ {application, emqx_authn, [
{description, "EMQX Authentication"}, {description, "EMQX Authentication"},
{vsn, "0.1.13"}, {vsn, "0.1.14"},
{modules, []}, {modules, []},
{registered, [emqx_authn_sup, emqx_authn_registry]}, {registered, [emqx_authn_sup, emqx_authn_registry]},
{applications, [kernel, stdlib, emqx_resource, emqx_connector, ehttpc, epgsql, mysql, jose]}, {applications, [kernel, stdlib, emqx_resource, emqx_connector, ehttpc, epgsql, mysql, jose]},

View File

@ -74,7 +74,7 @@ query(_) -> undefined.
query_timeout(type) -> emqx_schema:duration_ms(); query_timeout(type) -> emqx_schema:duration_ms();
query_timeout(desc) -> ?DESC(?FUNCTION_NAME); query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
query_timeout(default) -> "5s"; query_timeout(default) -> <<"5s">>;
query_timeout(_) -> undefined. query_timeout(_) -> undefined.
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{application, emqx_authz, [ {application, emqx_authz, [
{description, "An OTP application"}, {description, "An OTP application"},
{vsn, "0.1.13"}, {vsn, "0.1.14"},
{registered, []}, {registered, []},
{mod, {emqx_authz_app, []}}, {mod, {emqx_authz_app, []}},
{applications, [ {applications, [

View File

@ -108,7 +108,7 @@ authz_http_common_fields() ->
})}, })},
{request_timeout, {request_timeout,
mk_duration("Request timeout", #{ mk_duration("Request timeout", #{
required => false, default => "30s", desc => ?DESC(request_timeout) required => false, default => <<"30s">>, desc => ?DESC(request_timeout)
})} })}
] ++ ] ++
maps:to_list( maps:to_list(

View File

@ -223,7 +223,7 @@ http_common_fields() ->
{url, fun url/1}, {url, fun url/1},
{request_timeout, {request_timeout,
mk_duration("Request timeout", #{ mk_duration("Request timeout", #{
required => false, default => "30s", desc => ?DESC(request_timeout) required => false, default => <<"30s">>, desc => ?DESC(request_timeout)
})}, })},
{body, ?HOCON(map(), #{required => false, desc => ?DESC(body)})} {body, ?HOCON(map(), #{required => false, desc => ?DESC(body)})}
] ++ ] ++

View File

@ -145,7 +145,7 @@ fields("cluster") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "ekka.cluster_autoclean", mapping => "ekka.cluster_autoclean",
default => "5m", default => <<"5m">>,
desc => ?DESC(cluster_autoclean), desc => ?DESC(cluster_autoclean),
'readOnly' => true 'readOnly' => true
} }
@ -214,7 +214,7 @@ fields(cluster_mcast) ->
sc( sc(
string(), string(),
#{ #{
default => "239.192.0.1", default => <<"239.192.0.1">>,
desc => ?DESC(cluster_mcast_addr), desc => ?DESC(cluster_mcast_addr),
'readOnly' => true 'readOnly' => true
} }
@ -232,7 +232,7 @@ fields(cluster_mcast) ->
sc( sc(
string(), string(),
#{ #{
default => "0.0.0.0", default => <<"0.0.0.0">>,
desc => ?DESC(cluster_mcast_iface), desc => ?DESC(cluster_mcast_iface),
'readOnly' => true 'readOnly' => true
} }
@ -259,7 +259,7 @@ fields(cluster_mcast) ->
sc( sc(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
default => "16KB", default => <<"16KB">>,
desc => ?DESC(cluster_mcast_sndbuf), desc => ?DESC(cluster_mcast_sndbuf),
'readOnly' => true 'readOnly' => true
} }
@ -268,7 +268,7 @@ fields(cluster_mcast) ->
sc( sc(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
default => "16KB", default => <<"16KB">>,
desc => ?DESC(cluster_mcast_recbuf), desc => ?DESC(cluster_mcast_recbuf),
'readOnly' => true 'readOnly' => true
} }
@ -277,7 +277,7 @@ fields(cluster_mcast) ->
sc( sc(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
default => "32KB", default => <<"32KB">>,
desc => ?DESC(cluster_mcast_buffer), desc => ?DESC(cluster_mcast_buffer),
'readOnly' => true 'readOnly' => true
} }
@ -289,7 +289,7 @@ fields(cluster_dns) ->
sc( sc(
string(), string(),
#{ #{
default => "localhost", default => <<"localhost">>,
desc => ?DESC(cluster_dns_name), desc => ?DESC(cluster_dns_name),
'readOnly' => true 'readOnly' => true
} }
@ -318,7 +318,7 @@ fields(cluster_etcd) ->
sc( sc(
string(), string(),
#{ #{
default => "emqxcl", default => <<"emqxcl">>,
desc => ?DESC(cluster_etcd_prefix), desc => ?DESC(cluster_etcd_prefix),
'readOnly' => true 'readOnly' => true
} }
@ -327,7 +327,7 @@ fields(cluster_etcd) ->
sc( sc(
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
default => "1m", default => <<"1m">>,
'readOnly' => true, 'readOnly' => true,
desc => ?DESC(cluster_etcd_node_ttl) desc => ?DESC(cluster_etcd_node_ttl)
} }
@ -347,7 +347,7 @@ fields(cluster_k8s) ->
sc( sc(
string(), string(),
#{ #{
default => "http://10.110.111.204:8080", default => <<"http://10.110.111.204:8080">>,
desc => ?DESC(cluster_k8s_apiserver), desc => ?DESC(cluster_k8s_apiserver),
'readOnly' => true 'readOnly' => true
} }
@ -356,7 +356,7 @@ fields(cluster_k8s) ->
sc( sc(
string(), string(),
#{ #{
default => "emqx", default => <<"emqx">>,
desc => ?DESC(cluster_k8s_service_name), desc => ?DESC(cluster_k8s_service_name),
'readOnly' => true 'readOnly' => true
} }
@ -374,7 +374,7 @@ fields(cluster_k8s) ->
sc( sc(
string(), string(),
#{ #{
default => "default", default => <<"default">>,
desc => ?DESC(cluster_k8s_namespace), desc => ?DESC(cluster_k8s_namespace),
'readOnly' => true 'readOnly' => true
} }
@ -383,7 +383,7 @@ fields(cluster_k8s) ->
sc( sc(
string(), string(),
#{ #{
default => "pod.local", default => <<"pod.local">>,
'readOnly' => true, 'readOnly' => true,
desc => ?DESC(cluster_k8s_suffix) desc => ?DESC(cluster_k8s_suffix)
} }
@ -395,7 +395,7 @@ fields("node") ->
sc( sc(
string(), string(),
#{ #{
default => "emqx@127.0.0.1", default => <<"emqx@127.0.0.1">>,
'readOnly' => true, 'readOnly' => true,
desc => ?DESC(node_name) desc => ?DESC(node_name)
} }
@ -477,7 +477,7 @@ fields("node") ->
hoconsc:union([disabled, emqx_schema:duration()]), hoconsc:union([disabled, emqx_schema:duration()]),
#{ #{
mapping => "emqx_machine.global_gc_interval", mapping => "emqx_machine.global_gc_interval",
default => "15m", default => <<"15m">>,
desc => ?DESC(node_global_gc_interval), desc => ?DESC(node_global_gc_interval),
'readOnly' => true 'readOnly' => true
} }
@ -497,7 +497,7 @@ fields("node") ->
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
mapping => "vm_args.-env ERL_CRASH_DUMP_SECONDS", mapping => "vm_args.-env ERL_CRASH_DUMP_SECONDS",
default => "30s", default => <<"30s">>,
desc => ?DESC(node_crash_dump_seconds), desc => ?DESC(node_crash_dump_seconds),
'readOnly' => true 'readOnly' => true
} }
@ -507,7 +507,7 @@ fields("node") ->
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
mapping => "vm_args.-env ERL_CRASH_DUMP_BYTES", mapping => "vm_args.-env ERL_CRASH_DUMP_BYTES",
default => "100MB", default => <<"100MB">>,
desc => ?DESC(node_crash_dump_bytes), desc => ?DESC(node_crash_dump_bytes),
'readOnly' => true 'readOnly' => true
} }
@ -517,7 +517,7 @@ fields("node") ->
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
mapping => "vm_args.-kernel net_ticktime", mapping => "vm_args.-kernel net_ticktime",
default => "2m", default => <<"2m">>,
'readOnly' => true, 'readOnly' => true,
desc => ?DESC(node_dist_net_ticktime) desc => ?DESC(node_dist_net_ticktime)
} }
@ -624,7 +624,7 @@ fields("cluster_call") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
desc => ?DESC(cluster_call_retry_interval), desc => ?DESC(cluster_call_retry_interval),
default => "1m" default => <<"1m">>
} }
)}, )},
{"max_history", {"max_history",
@ -640,7 +640,7 @@ fields("cluster_call") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
desc => ?DESC(cluster_call_cleanup_interval), desc => ?DESC(cluster_call_cleanup_interval),
default => "5m" default => <<"5m">>
} }
)} )}
]; ];
@ -712,7 +712,7 @@ fields("rpc") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "gen_rpc.connect_timeout", mapping => "gen_rpc.connect_timeout",
default => "5s", default => <<"5s">>,
desc => ?DESC(rpc_connect_timeout) desc => ?DESC(rpc_connect_timeout)
} }
)}, )},
@ -745,7 +745,7 @@ fields("rpc") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "gen_rpc.send_timeout", mapping => "gen_rpc.send_timeout",
default => "5s", default => <<"5s">>,
desc => ?DESC(rpc_send_timeout) desc => ?DESC(rpc_send_timeout)
} }
)}, )},
@ -754,7 +754,7 @@ fields("rpc") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "gen_rpc.authentication_timeout", mapping => "gen_rpc.authentication_timeout",
default => "5s", default => <<"5s">>,
desc => ?DESC(rpc_authentication_timeout) desc => ?DESC(rpc_authentication_timeout)
} }
)}, )},
@ -763,7 +763,7 @@ fields("rpc") ->
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
mapping => "gen_rpc.call_receive_timeout", mapping => "gen_rpc.call_receive_timeout",
default => "15s", default => <<"15s">>,
desc => ?DESC(rpc_call_receive_timeout) desc => ?DESC(rpc_call_receive_timeout)
} }
)}, )},
@ -772,7 +772,7 @@ fields("rpc") ->
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
mapping => "gen_rpc.socket_keepalive_idle", mapping => "gen_rpc.socket_keepalive_idle",
default => "15m", default => <<"15m">>,
desc => ?DESC(rpc_socket_keepalive_idle) desc => ?DESC(rpc_socket_keepalive_idle)
} }
)}, )},
@ -781,7 +781,7 @@ fields("rpc") ->
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
mapping => "gen_rpc.socket_keepalive_interval", mapping => "gen_rpc.socket_keepalive_interval",
default => "75s", default => <<"75s">>,
desc => ?DESC(rpc_socket_keepalive_interval) desc => ?DESC(rpc_socket_keepalive_interval)
} }
)}, )},
@ -799,7 +799,7 @@ fields("rpc") ->
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
mapping => "gen_rpc.socket_sndbuf", mapping => "gen_rpc.socket_sndbuf",
default => "1MB", default => <<"1MB">>,
desc => ?DESC(rpc_socket_sndbuf) desc => ?DESC(rpc_socket_sndbuf)
} }
)}, )},
@ -808,7 +808,7 @@ fields("rpc") ->
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
mapping => "gen_rpc.socket_recbuf", mapping => "gen_rpc.socket_recbuf",
default => "1MB", default => <<"1MB">>,
desc => ?DESC(rpc_socket_recbuf) desc => ?DESC(rpc_socket_recbuf)
} }
)}, )},
@ -817,7 +817,7 @@ fields("rpc") ->
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
mapping => "gen_rpc.socket_buffer", mapping => "gen_rpc.socket_buffer",
default => "1MB", default => <<"1MB">>,
desc => ?DESC(rpc_socket_buffer) desc => ?DESC(rpc_socket_buffer)
} }
)}, )},
@ -861,7 +861,7 @@ fields("log_file_handler") ->
sc( sc(
hoconsc:union([infinity, emqx_schema:bytesize()]), hoconsc:union([infinity, emqx_schema:bytesize()]),
#{ #{
default => "50MB", default => <<"50MB">>,
desc => ?DESC("log_file_handler_max_size") desc => ?DESC("log_file_handler_max_size")
} }
)} )}
@ -899,7 +899,7 @@ fields("log_overload_kill") ->
sc( sc(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{ #{
default => "30MB", default => <<"30MB">>,
desc => ?DESC("log_overload_kill_mem_size") desc => ?DESC("log_overload_kill_mem_size")
} }
)}, )},
@ -915,7 +915,7 @@ fields("log_overload_kill") ->
sc( sc(
hoconsc:union([emqx_schema:duration_ms(), infinity]), hoconsc:union([emqx_schema:duration_ms(), infinity]),
#{ #{
default => "5s", default => <<"5s">>,
desc => ?DESC("log_overload_kill_restart_after") desc => ?DESC("log_overload_kill_restart_after")
} }
)} )}
@ -942,7 +942,7 @@ fields("log_burst_limit") ->
sc( sc(
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
default => "1s", default => <<"1s">>,
desc => ?DESC("log_burst_limit_window_time") desc => ?DESC("log_burst_limit_window_time")
} }
)} )}
@ -1092,7 +1092,7 @@ log_handler_common_confs(Enable) ->
sc( sc(
string(), string(),
#{ #{
default => "system", default => <<"system">>,
desc => ?DESC("common_handler_time_offset"), desc => ?DESC("common_handler_time_offset"),
validator => fun validate_time_offset/1 validator => fun validate_time_offset/1
} }
@ -1169,9 +1169,9 @@ crash_dump_file_default() ->
case os:getenv("RUNNER_LOG_DIR") of case os:getenv("RUNNER_LOG_DIR") of
false -> false ->
%% testing, or running emqx app as deps %% testing, or running emqx app as deps
"log/erl_crash.dump"; <<"log/erl_crash.dump">>;
Dir -> Dir ->
[filename:join([Dir, "erl_crash.dump"])] unicode:characters_to_binary(filename:join([Dir, "erl_crash.dump"]), utf8)
end. end.
%% utils %% utils

View File

@ -87,7 +87,7 @@ fields(config) ->
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC("connect_timeout") desc => ?DESC("connect_timeout")
} }
)}, )},

View File

@ -115,12 +115,12 @@ fields("server_configs") ->
desc => ?DESC("clean_start") desc => ?DESC("clean_start")
} }
)}, )},
{keepalive, mk_duration("MQTT Keepalive.", #{default => "300s"})}, {keepalive, mk_duration("MQTT Keepalive.", #{default => <<"300s">>})},
{retry_interval, {retry_interval,
mk_duration( mk_duration(
"Message retry interval. Delay for the MQTT bridge to retry sending the QoS1/QoS2 " "Message retry interval. Delay for the MQTT bridge to retry sending the QoS1/QoS2 "
"messages in case of ACK not received.", "messages in case of ACK not received.",
#{default => "15s"} #{default => <<"15s">>}
)}, )},
{max_inflight, {max_inflight,
mk( mk(

View File

@ -40,7 +40,7 @@ fields("dashboard") ->
?HOCON( ?HOCON(
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
default => "10s", default => <<"10s">>,
desc => ?DESC(sample_interval), desc => ?DESC(sample_interval),
validator => fun validate_sample_interval/1 validator => fun validate_sample_interval/1
} }
@ -49,7 +49,7 @@ fields("dashboard") ->
?HOCON( ?HOCON(
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
default => "60m", default => <<"60m">>,
desc => ?DESC(token_expired_time) desc => ?DESC(token_expired_time)
} }
)}, )},
@ -141,7 +141,7 @@ common_listener_fields() ->
?HOCON( ?HOCON(
emqx_schema:duration(), emqx_schema:duration(),
#{ #{
default => "10s", default => <<"10s">>,
desc => ?DESC(send_timeout) desc => ?DESC(send_timeout)
} }
)}, )},
@ -206,14 +206,14 @@ desc(_) ->
undefined. undefined.
default_username(type) -> binary(); default_username(type) -> binary();
default_username(default) -> "admin"; default_username(default) -> <<"admin">>;
default_username(required) -> true; default_username(required) -> true;
default_username(desc) -> ?DESC(default_username); default_username(desc) -> ?DESC(default_username);
default_username('readOnly') -> true; default_username('readOnly') -> true;
default_username(_) -> undefined. default_username(_) -> undefined.
default_password(type) -> binary(); default_password(type) -> binary();
default_password(default) -> "public"; default_password(default) -> <<"public">>;
default_password(required) -> true; default_password(required) -> true;
default_password('readOnly') -> true; default_password('readOnly') -> true;
default_password(sensitive) -> true; default_password(sensitive) -> true;

View File

@ -32,8 +32,8 @@ fields("root") ->
)}, )},
{default_username, fun default_username/1}, {default_username, fun default_username/1},
{default_password, fun default_password/1}, {default_password, fun default_password/1},
{sample_interval, mk(emqx_schema:duration_s(), #{default => "10s"})}, {sample_interval, mk(emqx_schema:duration_s(), #{default => <<"10s">>})},
{token_expired_time, mk(emqx_schema:duration(), #{default => "30m"})} {token_expired_time, mk(emqx_schema:duration(), #{default => <<"30m">>})}
]; ];
fields("ref1") -> fields("ref1") ->
[ [
@ -52,7 +52,7 @@ fields("ref3") ->
]. ].
default_username(type) -> string(); default_username(type) -> string();
default_username(default) -> "admin"; default_username(default) -> <<"admin">>;
default_username(required) -> true; default_username(required) -> true;
default_username(_) -> undefined. default_username(_) -> undefined.

View File

@ -790,7 +790,7 @@ to_schema(Body) ->
fields(good_ref) -> fields(good_ref) ->
[ [
{'webhook-host', mk(emqx_schema:ip_port(), #{default => "127.0.0.1:80"})}, {'webhook-host', mk(emqx_schema:ip_port(), #{default => <<"127.0.0.1:80">>})},
{log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})}, {log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})},
{tag, mk(binary(), #{desc => <<"tag">>})} {tag, mk(binary(), #{desc => <<"tag">>})}
]; ];

View File

@ -689,7 +689,7 @@ to_schema(Object) ->
fields(good_ref) -> fields(good_ref) ->
[ [
{'webhook-host', mk(emqx_schema:ip_port(), #{default => "127.0.0.1:80"})}, {'webhook-host', mk(emqx_schema:ip_port(), #{default => <<"127.0.0.1:80">>})},
{log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})}, {log_dir, mk(emqx_schema:file(), #{example => "var/log/emqx"})},
{tag, mk(binary(), #{desc => <<"tag">>})} {tag, mk(binary(), #{desc => <<"tag">>})}
]; ];

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{application, emqx_exhook, [ {application, emqx_exhook, [
{description, "EMQX Extension for Hook"}, {description, "EMQX Extension for Hook"},
{vsn, "5.0.9"}, {vsn, "5.0.10"},
{modules, []}, {modules, []},
{registered, []}, {registered, []},
{mod, {emqx_exhook_app, []}}, {mod, {emqx_exhook_app, []}},

View File

@ -229,9 +229,9 @@ server_conf_schema() ->
name => "default", name => "default",
enable => true, enable => true,
url => <<"http://127.0.0.1:8081">>, url => <<"http://127.0.0.1:8081">>,
request_timeout => "5s", request_timeout => <<"5s">>,
failed_action => deny, failed_action => deny,
auto_reconnect => "60s", auto_reconnect => <<"60s">>,
pool_size => 8, pool_size => 8,
ssl => SSL ssl => SSL
} }

View File

@ -63,7 +63,7 @@ fields(server) ->
})}, })},
{request_timeout, {request_timeout,
?HOCON(emqx_schema:duration(), #{ ?HOCON(emqx_schema:duration(), #{
default => "5s", default => <<"5s">>,
desc => ?DESC(request_timeout) desc => ?DESC(request_timeout)
})}, })},
{failed_action, failed_action()}, {failed_action, failed_action()},
@ -74,7 +74,7 @@ fields(server) ->
})}, })},
{auto_reconnect, {auto_reconnect,
?HOCON(hoconsc:union([false, emqx_schema:duration()]), #{ ?HOCON(hoconsc:union([false, emqx_schema:duration()]), #{
default => "60s", default => <<"60s">>,
desc => ?DESC(auto_reconnect) desc => ?DESC(auto_reconnect)
})}, })},
{pool_size, {pool_size,

View File

@ -267,7 +267,7 @@ fields(lwm2m) ->
sc( sc(
duration(), duration(),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC(lwm2m_lifetime_min) desc => ?DESC(lwm2m_lifetime_min)
} }
)}, )},
@ -275,7 +275,7 @@ fields(lwm2m) ->
sc( sc(
duration(), duration(),
#{ #{
default => "86400s", default => <<"86400s">>,
desc => ?DESC(lwm2m_lifetime_max) desc => ?DESC(lwm2m_lifetime_max)
} }
)}, )},
@ -283,7 +283,7 @@ fields(lwm2m) ->
sc( sc(
duration_s(), duration_s(),
#{ #{
default => "22s", default => <<"22s">>,
desc => ?DESC(lwm2m_qmode_time_window) desc => ?DESC(lwm2m_qmode_time_window)
} }
)}, )},
@ -624,7 +624,7 @@ mountpoint(Default) ->
sc( sc(
binary(), binary(),
#{ #{
default => Default, default => iolist_to_binary(Default),
desc => ?DESC(gateway_common_mountpoint) desc => ?DESC(gateway_common_mountpoint)
} }
). ).
@ -707,7 +707,7 @@ proxy_protocol_opts() ->
sc( sc(
duration(), duration(),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC(tcp_listener_proxy_protocol_timeout) desc => ?DESC(tcp_listener_proxy_protocol_timeout)
} }
)} )}

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*- %% -*- mode: erlang -*-
{application, emqx_plugins, [ {application, emqx_plugins, [
{description, "EMQX Plugin Management"}, {description, "EMQX Plugin Management"},
{vsn, "0.1.1"}, {vsn, "0.1.2"},
{modules, []}, {modules, []},
{mod, {emqx_plugins_app, []}}, {mod, {emqx_plugins_app, []}},
{applications, [kernel, stdlib, emqx]}, {applications, [kernel, stdlib, emqx]},

View File

@ -78,11 +78,11 @@ states(_) -> undefined.
install_dir(type) -> string(); install_dir(type) -> string();
install_dir(required) -> false; install_dir(required) -> false;
%% runner's root dir %% runner's root dir
install_dir(default) -> "plugins"; install_dir(default) -> <<"plugins">>;
install_dir(T) when T =/= desc -> undefined; install_dir(T) when T =/= desc -> undefined;
install_dir(desc) -> ?DESC(install_dir). install_dir(desc) -> ?DESC(install_dir).
check_interval(type) -> emqx_schema:duration(); check_interval(type) -> emqx_schema:duration();
check_interval(default) -> "5s"; check_interval(default) -> <<"5s">>;
check_interval(T) when T =/= desc -> undefined; check_interval(T) when T =/= desc -> undefined;
check_interval(desc) -> ?DESC(check_interval). check_interval(desc) -> ?DESC(check_interval).

View File

@ -40,7 +40,7 @@ fields("prometheus") ->
?HOCON( ?HOCON(
string(), string(),
#{ #{
default => "http://127.0.0.1:9091", default => <<"http://127.0.0.1:9091">>,
required => true, required => true,
validator => fun ?MODULE:validate_push_gateway_server/1, validator => fun ?MODULE:validate_push_gateway_server/1,
desc => ?DESC(push_gateway_server) desc => ?DESC(push_gateway_server)
@ -50,7 +50,7 @@ fields("prometheus") ->
?HOCON( ?HOCON(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
default => "15s", default => <<"15s">>,
required => true, required => true,
desc => ?DESC(interval) desc => ?DESC(interval)
} }

View File

@ -41,13 +41,13 @@ fields("retainer") ->
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
msg_expiry_interval, msg_expiry_interval,
"0s" <<"0s">>
)}, )},
{msg_clear_interval, {msg_clear_interval,
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
msg_clear_interval, msg_clear_interval,
"0s" <<"0s">>
)}, )},
{flow_control, {flow_control,
sc( sc(
@ -59,7 +59,7 @@ fields("retainer") ->
sc( sc(
emqx_schema:bytesize(), emqx_schema:bytesize(),
max_payload_size, max_payload_size,
"1MB" <<"1MB">>
)}, )},
{stop_publish_clear_msg, {stop_publish_clear_msg,
sc( sc(

View File

@ -51,7 +51,7 @@ fields("rule_engine") ->
?HOCON( ?HOCON(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
default => "10s", default => <<"10s">>,
desc => ?DESC("rule_engine_jq_function_default_timeout") desc => ?DESC("rule_engine_jq_function_default_timeout")
} }
)}, )},

View File

@ -1,7 +1,7 @@
{application, emqx_slow_subs, [ {application, emqx_slow_subs, [
{description, "EMQX Slow Subscribers Statistics"}, {description, "EMQX Slow Subscribers Statistics"},
% strict semver, bump manually! % strict semver, bump manually!
{vsn, "1.0.2"}, {vsn, "1.0.3"},
{modules, []}, {modules, []},
{registered, [emqx_slow_subs_sup]}, {registered, [emqx_slow_subs_sup]},
{applications, [kernel, stdlib, emqx]}, {applications, [kernel, stdlib, emqx]},

View File

@ -30,13 +30,13 @@ fields("slow_subs") ->
{threshold, {threshold,
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
"500ms", <<"500ms">>,
threshold threshold
)}, )},
{expire_interval, {expire_interval,
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
"300s", <<"300s">>,
expire_interval expire_interval
)}, )},
{top_k_num, {top_k_num,

View File

@ -77,9 +77,9 @@ statsd_config_schema() ->
statsd_example() -> statsd_example() ->
#{ #{
enable => true, enable => true,
flush_time_interval => "30s", flush_time_interval => <<"30s">>,
sample_time_interval => "30s", sample_time_interval => <<"30s">>,
server => "127.0.0.1:8125", server => <<"127.0.0.1:8125">>,
tags => #{} tags => #{}
}. }.

View File

@ -61,12 +61,12 @@ server() ->
emqx_schema:servers_sc(Meta, ?SERVER_PARSE_OPTS). emqx_schema:servers_sc(Meta, ?SERVER_PARSE_OPTS).
sample_interval(type) -> emqx_schema:duration_ms(); sample_interval(type) -> emqx_schema:duration_ms();
sample_interval(default) -> "30s"; sample_interval(default) -> <<"30s">>;
sample_interval(desc) -> ?DESC(?FUNCTION_NAME); sample_interval(desc) -> ?DESC(?FUNCTION_NAME);
sample_interval(_) -> undefined. sample_interval(_) -> undefined.
flush_interval(type) -> emqx_schema:duration_ms(); flush_interval(type) -> emqx_schema:duration_ms();
flush_interval(default) -> "30s"; flush_interval(default) -> <<"30s">>;
flush_interval(desc) -> ?DESC(?FUNCTION_NAME); flush_interval(desc) -> ?DESC(?FUNCTION_NAME);
flush_interval(_) -> undefined. flush_interval(_) -> undefined.

View File

@ -50,7 +50,7 @@ fields(bridge_config) ->
sc( sc(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
default => "15s", default => <<"15s">>,
desc => ?DESC("connect_timeout") desc => ?DESC("connect_timeout")
} }
)}, )},
@ -84,7 +84,7 @@ fields(bridge_config) ->
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
required => false, required => false,
default => "15s", default => <<"15s">>,
desc => ?DESC("request_timeout") desc => ?DESC("request_timeout")
} }
)}, )},

View File

@ -84,20 +84,20 @@ fields("config") ->
)}, )},
{connect_timeout, {connect_timeout,
mk(emqx_schema:duration_ms(), #{ mk(emqx_schema:duration_ms(), #{
default => "5s", default => <<"5s">>,
desc => ?DESC(connect_timeout) desc => ?DESC(connect_timeout)
})}, })},
{min_metadata_refresh_interval, {min_metadata_refresh_interval,
mk( mk(
emqx_schema:duration_ms(), emqx_schema:duration_ms(),
#{ #{
default => "3s", default => <<"3s">>,
desc => ?DESC(min_metadata_refresh_interval) desc => ?DESC(min_metadata_refresh_interval)
} }
)}, )},
{metadata_request_timeout, {metadata_request_timeout,
mk(emqx_schema:duration_ms(), #{ mk(emqx_schema:duration_ms(), #{
default => "5s", default => <<"5s">>,
desc => ?DESC(metadata_request_timeout) desc => ?DESC(metadata_request_timeout)
})}, })},
{authentication, {authentication,
@ -141,12 +141,12 @@ fields(socket_opts) ->
{sndbuf, {sndbuf,
mk( mk(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{default => "1024KB", desc => ?DESC(socket_send_buffer)} #{default => <<"1024KB">>, desc => ?DESC(socket_send_buffer)}
)}, )},
{recbuf, {recbuf,
mk( mk(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{default => "1024KB", desc => ?DESC(socket_receive_buffer)} #{default => <<"1024KB">>, desc => ?DESC(socket_receive_buffer)}
)}, )},
{nodelay, {nodelay,
mk( mk(
@ -170,7 +170,7 @@ fields(producer_kafka_opts) ->
{topic, mk(string(), #{required => true, desc => ?DESC(kafka_topic)})}, {topic, mk(string(), #{required => true, desc => ?DESC(kafka_topic)})},
{message, mk(ref(kafka_message), #{required => false, desc => ?DESC(kafka_message)})}, {message, mk(ref(kafka_message), #{required => false, desc => ?DESC(kafka_message)})},
{max_batch_bytes, {max_batch_bytes,
mk(emqx_schema:bytesize(), #{default => "896KB", desc => ?DESC(max_batch_bytes)})}, mk(emqx_schema:bytesize(), #{default => <<"896KB">>, desc => ?DESC(max_batch_bytes)})},
{compression, {compression,
mk(enum([no_compression, snappy, gzip]), #{ mk(enum([no_compression, snappy, gzip]), #{
default => no_compression, desc => ?DESC(compression) default => no_compression, desc => ?DESC(compression)
@ -192,7 +192,7 @@ fields(producer_kafka_opts) ->
mk( mk(
emqx_schema:duration_s(), emqx_schema:duration_s(),
#{ #{
default => "60s", default => <<"60s">>,
desc => ?DESC(partition_count_refresh_interval) desc => ?DESC(partition_count_refresh_interval)
} }
)}, )},
@ -212,11 +212,11 @@ fields(producer_kafka_opts) ->
]; ];
fields(kafka_message) -> fields(kafka_message) ->
[ [
{key, mk(string(), #{default => "${.clientid}", desc => ?DESC(kafka_message_key)})}, {key, mk(string(), #{default => <<"${.clientid}">>, desc => ?DESC(kafka_message_key)})},
{value, mk(string(), #{default => "${.}", desc => ?DESC(kafka_message_value)})}, {value, mk(string(), #{default => <<"${.}">>, desc => ?DESC(kafka_message_value)})},
{timestamp, {timestamp,
mk(string(), #{ mk(string(), #{
default => "${.timestamp}", desc => ?DESC(kafka_message_timestamp) default => <<"${.timestamp}">>, desc => ?DESC(kafka_message_timestamp)
})} })}
]; ];
fields(producer_buffer) -> fields(producer_buffer) ->
@ -229,12 +229,12 @@ fields(producer_buffer) ->
{per_partition_limit, {per_partition_limit,
mk( mk(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{default => "2GB", desc => ?DESC(buffer_per_partition_limit)} #{default => <<"2GB">>, desc => ?DESC(buffer_per_partition_limit)}
)}, )},
{segment_bytes, {segment_bytes,
mk( mk(
emqx_schema:bytesize(), emqx_schema:bytesize(),
#{default => "100MB", desc => ?DESC(buffer_segment_bytes)} #{default => <<"100MB">>, desc => ?DESC(buffer_segment_bytes)}
)}, )},
{memory_overload_protection, {memory_overload_protection,
mk(boolean(), #{ mk(boolean(), #{

View File

@ -46,12 +46,12 @@ fields(key_license) ->
}}, }},
{connection_low_watermark, #{ {connection_low_watermark, #{
type => emqx_schema:percent(), type => emqx_schema:percent(),
default => "75%", default => <<"75%">>,
desc => ?DESC(connection_low_watermark_field) desc => ?DESC(connection_low_watermark_field)
}}, }},
{connection_high_watermark, #{ {connection_high_watermark, #{
type => emqx_schema:percent(), type => emqx_schema:percent(),
default => "80%", default => <<"80%">>,
desc => ?DESC(connection_high_watermark_field) desc => ?DESC(connection_high_watermark_field)
}} }}
]. ].