refactor(schema): change file() type to string()

This commit is contained in:
Zaiming (Stone) Shi 2023-11-08 16:33:07 +01:00
parent af3dfc91b1
commit 7a0a0bee98
2 changed files with 6 additions and 8 deletions

View File

@ -28,13 +28,11 @@
-include("emqx_conf.hrl"). -include("emqx_conf.hrl").
-type file() :: string().
-type cipher() :: map(). -type cipher() :: map().
-behaviour(hocon_schema). -behaviour(hocon_schema).
-reflect_type([ -reflect_type([
file/0,
cipher/0 cipher/0
]). ]).
@ -546,7 +544,7 @@ fields("node") ->
)}, )},
{"crash_dump_file", {"crash_dump_file",
sc( sc(
file(), string(),
#{ #{
mapping => "vm_args.-env ERL_CRASH_DUMP", mapping => "vm_args.-env ERL_CRASH_DUMP",
desc => ?DESC(node_crash_dump_file), desc => ?DESC(node_crash_dump_file),
@ -837,7 +835,7 @@ fields("rpc") ->
)}, )},
{"certfile", {"certfile",
sc( sc(
file(), string(),
#{ #{
mapping => "gen_rpc.certfile", mapping => "gen_rpc.certfile",
converter => fun ensure_unicode_path/2, converter => fun ensure_unicode_path/2,
@ -846,7 +844,7 @@ fields("rpc") ->
)}, )},
{"keyfile", {"keyfile",
sc( sc(
file(), string(),
#{ #{
mapping => "gen_rpc.keyfile", mapping => "gen_rpc.keyfile",
converter => fun ensure_unicode_path/2, converter => fun ensure_unicode_path/2,
@ -855,7 +853,7 @@ fields("rpc") ->
)}, )},
{"cacertfile", {"cacertfile",
sc( sc(
file(), string(),
#{ #{
mapping => "gen_rpc.cacertfile", mapping => "gen_rpc.cacertfile",
converter => fun ensure_unicode_path/2, converter => fun ensure_unicode_path/2,
@ -1002,7 +1000,7 @@ fields("log_file_handler") ->
[ [
{"path", {"path",
sc( sc(
file(), string(),
#{ #{
desc => ?DESC("log_file_handler_file"), desc => ?DESC("log_file_handler_file"),
default => <<"${EMQX_LOG_DIR}/emqx.log">>, default => <<"${EMQX_LOG_DIR}/emqx.log">>,

View File

@ -53,7 +53,7 @@ fields("log_audit_handler") ->
{"path", {"path",
hoconsc:mk( hoconsc:mk(
emqx_conf_schema:file(), string(),
#{ #{
desc => ?DESC(emqx_conf_schema, "audit_file_handler_path"), desc => ?DESC(emqx_conf_schema, "audit_file_handler_path"),
default => <<"${EMQX_LOG_DIR}/audit.log">>, default => <<"${EMQX_LOG_DIR}/audit.log">>,