refactor: rename RUNNER_ETC_DIR to EMQX_ETC_DIR
This commit is contained in:
parent
bc5692efd4
commit
32694e601a
|
@ -275,8 +275,9 @@ etc_file(SubPath) ->
|
|||
filename:join([etc_dir(), SubPath]).
|
||||
|
||||
etc_dir() ->
|
||||
%% EMQX_ETC_DIR is inherited from RUNNER_ETC_DIR which is set at package build time.
|
||||
%% when it's not set, it's most likely when running test cases.
|
||||
%% EMQX_ETC_DIR set by emqx boot script,
|
||||
%% if it's not set, then it must be test environment
|
||||
%% which should uses default path
|
||||
Env = os:getenv("EMQX_ETC_DIR"),
|
||||
case Env =:= "" orelse Env =:= false of
|
||||
true -> "etc";
|
||||
|
|
|
@ -830,7 +830,7 @@ tr_config_files(Conf) ->
|
|||
[_ | _] = Files ->
|
||||
Files;
|
||||
_ ->
|
||||
case os:getenv("RUNNER_ETC_DIR") of
|
||||
case os:getenv("EMQX_ETC_DIR") of
|
||||
false ->
|
||||
[filename:join([code:lib_dir(emqx), "etc", "emqx.conf"])];
|
||||
Dir ->
|
||||
|
|
17
bin/emqx
17
bin/emqx
|
@ -15,17 +15,10 @@ ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
|
|||
|
||||
# defined in emqx_vars
|
||||
export RUNNER_ROOT_DIR
|
||||
export RUNNER_ETC_DIR
|
||||
export EMQX_ETC_DIR
|
||||
export REL_VSN
|
||||
export SCHEMA_MOD
|
||||
|
||||
# RUNNER_ETC_DIR is only used at boot time
|
||||
# EMQX_ETC_DIR is by default RUNNER_ETC_DIR but the absolute path
|
||||
# it is used at runtime by the emqx program
|
||||
# so that it won't change even if file:set_cwd is evaluated by EMQX later
|
||||
EMQX_ETC_DIR="${EMQX_ETC_DIR:-$(cd "$(readlink "$RUNNER_ETC_DIR")"; pwd -P)}"
|
||||
export EMQX_ETC_DIR
|
||||
|
||||
RUNNER_SCRIPT="$RUNNER_BIN_DIR/$REL_NAME"
|
||||
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
|
||||
REL_DIR="$RUNNER_ROOT_DIR/releases/$REL_VSN"
|
||||
|
@ -362,7 +355,7 @@ call_hocon() {
|
|||
|
||||
get_config_value() {
|
||||
path_to_value="$1"
|
||||
call_hocon -s "$SCHEMA_MOD" -c "$RUNNER_ETC_DIR"/emqx.conf get "$path_to_value" | tr -d \"
|
||||
call_hocon -s "$SCHEMA_MOD" -c "$EMQX_ETC_DIR"/emqx.conf get "$path_to_value" | tr -d \"
|
||||
}
|
||||
|
||||
check_license() {
|
||||
|
@ -425,7 +418,7 @@ generate_config() {
|
|||
## NOTE: the generate command merges environment variables to the base config (emqx.conf),
|
||||
## but does not include the cluster-override.conf and local-override.conf
|
||||
## meaning, certain overrides will not be mapped to app.<time>.config file
|
||||
call_hocon -v -t "$NOW_TIME" -s "$SCHEMA_MOD" -c "$RUNNER_ETC_DIR"/emqx.conf -d "$DATA_DIR"/configs generate
|
||||
call_hocon -v -t "$NOW_TIME" -s "$SCHEMA_MOD" -c "$EMQX_ETC_DIR"/emqx.conf -d "$DATA_DIR"/configs generate
|
||||
|
||||
## filenames are per-hocon convention
|
||||
local CONF_FILE="$CONFIGS_DIR/app.$NOW_TIME.config"
|
||||
|
@ -440,7 +433,7 @@ generate_config() {
|
|||
|
||||
## Merge hocon generated *.args into the vm.args
|
||||
TMP_ARG_FILE="$CONFIGS_DIR/vm.args.tmp"
|
||||
cp "$RUNNER_ETC_DIR/vm.args" "$TMP_ARG_FILE"
|
||||
cp "$EMQX_ETC_DIR/vm.args" "$TMP_ARG_FILE"
|
||||
echo "" >> "$TMP_ARG_FILE"
|
||||
echo "-pa ${REL_DIR}/consolidated" >> "$TMP_ARG_FILE"
|
||||
## read lines from generated vm.<time>.args file
|
||||
|
@ -656,7 +649,7 @@ if [ -z "$COOKIE" ]; then
|
|||
fi
|
||||
|
||||
if [ -z "$COOKIE" ]; then
|
||||
die "Please set node.cookie in $RUNNER_ETC_DIR/emqx.conf or override from environment variable EMQX_NODE__COOKIE"
|
||||
die "Please set node.cookie in $EMQX_ETC_DIR/emqx.conf or override from environment variable EMQX_NODE__COOKIE"
|
||||
fi
|
||||
|
||||
cd "$ROOTDIR"
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
@set "rel_dir=%rel_root_dir%\releases\%rel_vsn%"
|
||||
@set "RUNNER_ROOT_DIR=%rel_root_dir%"
|
||||
:: hard code etc dir
|
||||
@set "RUNNER_ETC_DIR=%rel_root_dir%\etc"
|
||||
@set "EMQX_ETC_DIR=%rel_root_dir%\etc"
|
||||
@set "etc_dir=%rel_root_dir%\etc"
|
||||
@set "lib_dir=%rel_root_dir%\lib"
|
||||
|
|
4
mix.exs
4
mix.exs
|
@ -539,7 +539,7 @@ defmodule EMQXUmbrella.MixProject do
|
|||
platform_plugins_dir: "plugins",
|
||||
runner_root_dir: "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)",
|
||||
runner_bin_dir: "$RUNNER_ROOT_DIR/bin",
|
||||
runner_etc_dir: "$RUNNER_ROOT_DIR/etc",
|
||||
emqx_etc_dir: "$RUNNER_ROOT_DIR/etc",
|
||||
runner_lib_dir: "$RUNNER_ROOT_DIR/lib",
|
||||
runner_log_dir: "$RUNNER_ROOT_DIR/log",
|
||||
runner_user: "",
|
||||
|
@ -565,7 +565,7 @@ defmodule EMQXUmbrella.MixProject do
|
|||
platform_plugins_dir: "/var/lib/emqx/plugins",
|
||||
runner_root_dir: "/usr/lib/emqx",
|
||||
runner_bin_dir: "/usr/bin",
|
||||
runner_etc_dir: "/etc/emqx",
|
||||
emqx_etc_dir: "/etc/emqx",
|
||||
runner_lib_dir: "$RUNNER_ROOT_DIR/lib",
|
||||
runner_log_dir: "/var/log/emqx",
|
||||
runner_user: "emqx",
|
||||
|
|
|
@ -275,7 +275,7 @@ overlay_vars_pkg(bin) ->
|
|||
, {platform_plugins_dir, "plugins"}
|
||||
, {runner_root_dir, "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)"}
|
||||
, {runner_bin_dir, "$RUNNER_ROOT_DIR/bin"}
|
||||
, {runner_etc_dir, "$RUNNER_ROOT_DIR/etc"}
|
||||
, {emqx_etc_dir, "$RUNNER_ROOT_DIR/etc"}
|
||||
, {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"}
|
||||
, {runner_log_dir, "$RUNNER_ROOT_DIR/log"}
|
||||
, {runner_user, ""}
|
||||
|
@ -290,7 +290,7 @@ overlay_vars_pkg(pkg) ->
|
|||
, {platform_plugins_dir, "/var/lib/emqx/plugins"}
|
||||
, {runner_root_dir, "/usr/lib/emqx"}
|
||||
, {runner_bin_dir, "/usr/bin"}
|
||||
, {runner_etc_dir, "/etc/emqx"}
|
||||
, {emqx_etc_dir, "/etc/emqx"}
|
||||
, {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"}
|
||||
, {runner_log_dir, "/var/log/emqx"}
|
||||
, {runner_user, "emqx"}
|
||||
|
|
|
@ -10,7 +10,7 @@ RUNNER_ROOT_DIR="{{ runner_root_dir }}"
|
|||
RUNNER_BIN_DIR="{{ runner_bin_dir }}"
|
||||
RUNNER_LOG_DIR="{{ runner_log_dir }}"
|
||||
RUNNER_LIB_DIR="{{ runner_lib_dir }}"
|
||||
RUNNER_ETC_DIR="{{ runner_etc_dir }}"
|
||||
EMQX_ETC_DIR="{{ emqx_etc_dir }}"
|
||||
RUNNER_USER="{{ runner_user }}"
|
||||
IS_ELIXIR="{{ is_elixir }}"
|
||||
SCHEMA_MOD="{{ emqx_schema_mod }}"
|
||||
|
|
Loading…
Reference in New Issue