fix: define ssl SNI field as a non-empty-string
This commit is contained in:
parent
46550d5a6f
commit
0635918d16
|
@ -57,6 +57,7 @@
|
|||
validate_heap_size/1,
|
||||
parse_user_lookup_fun/1,
|
||||
validate_alarm_actions/1,
|
||||
non_empty_string/1,
|
||||
validations/0
|
||||
]).
|
||||
|
||||
|
@ -1898,6 +1899,7 @@ client_ssl_opts_schema(Defaults1) ->
|
|||
hoconsc:union([disable, string()]),
|
||||
#{
|
||||
required => false,
|
||||
validator => fun emqx_schema:non_empty_string/1,
|
||||
desc => ?DESC(client_ssl_opts_schema_server_name_indication)
|
||||
}
|
||||
)}
|
||||
|
@ -2177,3 +2179,8 @@ authentication(Type) ->
|
|||
-spec qos() -> typerefl:type().
|
||||
qos() ->
|
||||
typerefl:alias("qos", typerefl:union([0, 1, 2])).
|
||||
|
||||
non_empty_string(<<>>) -> {error, empty_string_not_allowed};
|
||||
non_empty_string("") -> {error, empty_string_not_allowed};
|
||||
non_empty_string(S) when is_binary(S); is_list(S) -> ok;
|
||||
non_empty_string(_) -> {error, invalid_string}.
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
, egress_desc/0
|
||||
]).
|
||||
|
||||
-export([non_empty_string/1]).
|
||||
|
||||
-import(emqx_schema, [mk_duration/2]).
|
||||
|
||||
namespace() -> "connector-mqtt".
|
||||
|
@ -98,7 +96,7 @@ fields("ingress") ->
|
|||
[ {remote_topic,
|
||||
sc(binary(),
|
||||
#{ required => true
|
||||
, validator => fun ?MODULE:non_empty_string/1
|
||||
, validator => fun emqx_schema:non_empty_string/1
|
||||
, desc => ?DESC("ingress_remote_topic")
|
||||
})}
|
||||
, {remote_qos,
|
||||
|
@ -108,7 +106,7 @@ fields("ingress") ->
|
|||
})}
|
||||
, {local_topic,
|
||||
sc(binary(),
|
||||
#{ validator => fun ?MODULE:non_empty_string/1
|
||||
#{ validator => fun emqx_schema:non_empty_string/1
|
||||
, desc => ?DESC("ingress_local_topic")
|
||||
})}
|
||||
, {local_qos,
|
||||
|
@ -140,12 +138,12 @@ fields("egress") ->
|
|||
[ {local_topic,
|
||||
sc(binary(),
|
||||
#{ desc => ?DESC("egress_local_topic")
|
||||
, validator => fun ?MODULE:non_empty_string/1
|
||||
, validator => fun emqx_schema:non_empty_string/1
|
||||
})}
|
||||
, {remote_topic,
|
||||
sc(binary(),
|
||||
#{ required => true
|
||||
, validator => fun ?MODULE:non_empty_string/1
|
||||
, validator => fun emqx_schema:non_empty_string/1
|
||||
, desc => ?DESC("egress_remote_topic")
|
||||
})}
|
||||
, {remote_qos,
|
||||
|
@ -228,10 +226,5 @@ local_topic will be forwarded.
|
|||
qos() ->
|
||||
hoconsc:union([emqx_schema:qos(), binary()]).
|
||||
|
||||
non_empty_string(<<>>) -> {error, empty_string_not_allowed};
|
||||
non_empty_string("") -> {error, empty_string_not_allowed};
|
||||
non_empty_string(S) when is_binary(S); is_list(S) -> ok;
|
||||
non_empty_string(_) -> {error, invalid_string}.
|
||||
|
||||
sc(Type, Meta) -> hoconsc:mk(Type, Meta).
|
||||
ref(Field) -> hoconsc:ref(?MODULE, Field).
|
||||
|
|
Loading…
Reference in New Issue