From f971dfd149daf938dd7db00df063ed7f0ee9cb11 Mon Sep 17 00:00:00 2001 From: Spycsh <757407490@qq.com> Date: Fri, 10 Sep 2021 19:44:33 +0800 Subject: [PATCH] chore(config): add etc dir config --- apps/emqx_machine/etc/emqx_machine.conf | 3 +++ apps/emqx_machine/src/emqx_machine_schema.erl | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/apps/emqx_machine/etc/emqx_machine.conf b/apps/emqx_machine/etc/emqx_machine.conf index 3ec09f2d4..eeab91154 100644 --- a/apps/emqx_machine/etc/emqx_machine.conf +++ b/apps/emqx_machine/etc/emqx_machine.conf @@ -41,6 +41,9 @@ node { ## Default: 15m global_gc_interval = 15m + ## Sets the etc directory + etc_dir = "{{ platform_etc_dir }}" + ## Sets the net_kernel tick time in seconds. ## Notice that all communicating nodes are to have the same ## TickTime value specified. diff --git a/apps/emqx_machine/src/emqx_machine_schema.erl b/apps/emqx_machine/src/emqx_machine_schema.erl index e4f7a8d1a..5d1acb02e 100644 --- a/apps/emqx_machine/src/emqx_machine_schema.erl +++ b/apps/emqx_machine/src/emqx_machine_schema.erl @@ -310,6 +310,27 @@ fields("node") -> sc(ref("cluster_call"), #{} )} + , {"etc_dir", + sc(string(), + #{ + converter => fun(EtcDir) -> + case filename:absname(EtcDir) =:= EtcDir of + true -> + unicode:characters_to_list(EtcDir); + false -> + unicode:characters_to_list(filename:join([code:lib_dir(), "..", EtcDir])) + end + end, + validator => fun(Path) -> + case filelib:is_dir(Path) of + true -> + ok; + false -> + error({not_dir, Path}) + end + end + } + )} ]; fields("cluster_call") ->