Просмотр исходного кода

chore(config): add etc dir config

Spycsh 4 лет назад
Родитель
Сommit
f971dfd149

+ 3 - 0
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.

+ 21 - 0
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") ->