chore: allow special chars in log dir

the current valdiator does not allow space and ':' in log file path
which is an unresonable restriction
This commit is contained in:
Zaiming (Stone) Shi 2023-05-22 23:07:47 +02:00
parent 3b6295a085
commit 91150e6d83
2 changed files with 2 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_conf, [ {application, emqx_conf, [
{description, "EMQX configuration management"}, {description, "EMQX configuration management"},
{vsn, "0.1.19"}, {vsn, "0.1.20"},
{registered, []}, {registered, []},
{mod, {emqx_conf_app, []}}, {mod, {emqx_conf_app, []}},
{applications, [kernel, stdlib, emqx_ctl]}, {applications, [kernel, stdlib, emqx_ctl]},

View File

@ -893,8 +893,7 @@ fields("log_file_handler") ->
#{ #{
desc => ?DESC("log_file_handler_file"), desc => ?DESC("log_file_handler_file"),
default => <<"${EMQX_LOG_DIR}/emqx.log">>, default => <<"${EMQX_LOG_DIR}/emqx.log">>,
converter => fun emqx_schema:naive_env_interpolation/1, converter => fun emqx_schema:naive_env_interpolation/1
validator => fun validate_file_location/1
} }
)}, )},
{"rotation", {"rotation",
@ -1333,11 +1332,6 @@ emqx_schema_high_prio_roots() ->
)}, )},
lists:keyreplace("authorization", 1, Roots, Authz). lists:keyreplace("authorization", 1, Roots, Authz).
validate_file_location(File) ->
ValidFile = "^[/\\_a-zA-Z0-9\\.\\-]*$",
Error = "Invalid file name: " ++ ValidFile,
validator_string_re(File, ValidFile, Error).
validate_time_offset(Offset) -> validate_time_offset(Offset) ->
ValidTimeOffset = "^([\\-\\+][0-1][0-9]:[0-6][0-9]|system|utc)$", ValidTimeOffset = "^([\\-\\+][0-1][0-9]:[0-6][0-9]|system|utc)$",
Error = Error =