fix: filter data's dir

This commit is contained in:
Zhongwen Deng 2022-07-01 15:32:12 +08:00
parent 9af470dee9
commit 3d6f98e5f6
1 changed files with 4 additions and 1 deletions

View File

@ -59,7 +59,10 @@ get_override_config_file() ->
sync_data_from_node() ->
Dir = emqx:data_dir(),
{ok, Zip} = zip:zip(atom_to_list(node()) ++ "_data.zip", ["authz", "certs"], [{cwd, Dir}]),
TargetDirs = lists:filter(fun(Type) -> filelib:is_dir(filename:join(Dir, Type)) end, [
"authz", "certs"
]),
{ok, Zip} = zip:zip(atom_to_list(node()) ++ "_data.zip", TargetDirs, [{cwd, Dir}]),
Res = {ok, _Bin} = file:read_file(Zip),
_ = file:delete(Zip),
Res.