fix(conf): check node name, otp regular expression
This commit is contained in:
parent
84fa6bfaeb
commit
cdb1c149e7
|
@ -31,6 +31,7 @@ File format:
|
|||
* Improved resilience against autocluster partitioning during cluster
|
||||
startup. [#7876]
|
||||
[ekka-158](https://github.com/emqx/ekka/pull/158)
|
||||
* Fix Added regularity (`^[0-9A-Za-z_\-]+$`) check for node names
|
||||
|
||||
## v4.3.14
|
||||
|
||||
|
|
|
@ -206,6 +206,21 @@ end}.
|
|||
{override_env, "NODE_NAME"}
|
||||
]}.
|
||||
|
||||
%% Node name regular expression from net_kernel:valid_name_head/1.
|
||||
%% Be same with otp.
|
||||
{translation, "vm_args.-name",
|
||||
fun(Conf) ->
|
||||
NodeName = cuttlefish:conf_get("node.name", Conf),
|
||||
{Head, _Host} = lists:splitwith(fun(C) -> C =/= $@ end, NodeName),
|
||||
{ok, MP} = re:compile("^[0-9A-Za-z_\\-]+$", [unicode]),
|
||||
case re:run(Head, MP) of
|
||||
{match, _} ->
|
||||
NodeName;
|
||||
nomatch ->
|
||||
cuttlefish:invalid("Bad node name, expect ^[0-9A-Za-z_\\-]+$")
|
||||
end
|
||||
end}.
|
||||
|
||||
%% @doc Specify SSL Options in the file if using SSL for erlang distribution
|
||||
{mapping, "node.ssl_dist_optfile", "vm_args.-ssl_dist_optfile", [
|
||||
{datatype, string},
|
||||
|
|
Loading…
Reference in New Issue