chore(emqx_conf): extract data dirs to sync to a macro
This commit is contained in:
parent
3386f565aa
commit
035b8480b0
|
@ -81,11 +81,13 @@ get_override_config_file() ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-define(DATA_DIRS, ["authz", "certs"]).
|
||||||
|
|
||||||
sync_data_from_node() ->
|
sync_data_from_node() ->
|
||||||
Dir = emqx:data_dir(),
|
Dir = emqx:data_dir(),
|
||||||
TargetDirs = lists:filter(fun(Type) -> filelib:is_dir(filename:join(Dir, Type)) end, [
|
TargetDirs = lists:filter(
|
||||||
"authz", "certs"
|
fun(Type) -> filelib:is_dir(filename:join(Dir, Type)) end, ?DATA_DIRS
|
||||||
]),
|
),
|
||||||
Name = "data.zip",
|
Name = "data.zip",
|
||||||
case zip:zip(Name, TargetDirs, [memory, {cwd, Dir}]) of
|
case zip:zip(Name, TargetDirs, [memory, {cwd, Dir}]) of
|
||||||
{ok, {Name, Bin}} -> {ok, Bin};
|
{ok, {Name, Bin}} -> {ok, Bin};
|
||||||
|
|
Loading…
Reference in New Issue