Config location logging
This commit is contained in:
parent
173260d91e
commit
d937467ee0
|
|
@ -39,7 +39,7 @@ LOG_BASE=${SYS_PREFIX}/var/log/rabbitmq
|
|||
MNESIA_BASE=${SYS_PREFIX}/var/lib/rabbitmq/mnesia
|
||||
ENABLED_PLUGINS_FILE=${SYS_PREFIX}/etc/rabbitmq/enabled_plugins
|
||||
GENERATED_CONFIG_DIR=${SYS_PREFIX}/var/lib/rabbitmq/config
|
||||
RABBITMQ_CONFIG_ADVANCED=${SYS_PREFIX}/etc/rabbitmq/advanced
|
||||
CONFIG_ADVANCED=${SYS_PREFIX}/etc/rabbitmq/advanced
|
||||
|
||||
PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
|
||||
IO_THREAD_POOL_SIZE=64
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ set LOG_BASE=!RABBITMQ_BASE!\log
|
|||
set MNESIA_BASE=!RABBITMQ_BASE!\db
|
||||
set ENABLED_PLUGINS_FILE=!RABBITMQ_BASE!\enabled_plugins
|
||||
set GENERATED_CONFIG_DIR=!RABBITMQ_BASE!\config
|
||||
set RABBITMQ_CONFIG_ADVANCED=!RABBITMQ_BASE!\advanced
|
||||
set CONFIG_ADVANCED=!RABBITMQ_BASE!\advanced
|
||||
|
||||
REM PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
|
||||
for /f "delims=" %%F in ("!TDP0!..\plugins") do set PLUGINS_DIR=%%~dpsF%%~nF%%~xF
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ DEFAULT_NODE_PORT=5672
|
|||
[ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${MNESIA_DIR}
|
||||
[ "x" = "x$RABBITMQ_MNESIA_DIR" ] && RABBITMQ_MNESIA_DIR=${RABBITMQ_MNESIA_BASE}/${RABBITMQ_NODENAME}
|
||||
[ "x" = "x$RABBITMQ_GENERATED_CONFIG_DIR" ] && RABBITMQ_GENERATED_CONFIG_DIR=${GENERATED_CONFIG_DIR}
|
||||
[ "x" = "x$RABBITMQ_CONFIG_ADVANCED" ] && RABBITMQ_CONFIG_ADVANCED=${CONFIG_ADVANCED}
|
||||
|
||||
rmq_normalize_path_var \
|
||||
RABBITMQ_CONFIG_FILE \
|
||||
|
|
|
|||
|
|
@ -166,6 +166,14 @@ if "!RABBITMQ_GENERATED_CONFIG_DIR!"=="" (
|
|||
)
|
||||
)
|
||||
|
||||
if "!RABBITMQ_CONFIG_ADVANCED!"=="" (
|
||||
if "!CONFIG_ADVANCED!"=="" (
|
||||
set RABBITMQ_CONFIG_ADVANCED=!RABBITMQ_BASE!\advanced
|
||||
) else (
|
||||
set RABBITMQ_CONFIG_ADVANCED=!GENERATED_CONFIG_DIR!
|
||||
)
|
||||
)
|
||||
|
||||
REM [ "x" = "x$RABBITMQ_LOG_BASE" ] && RABBITMQ_LOG_BASE=${LOG_BASE}
|
||||
if "!RABBITMQ_LOG_BASE!"=="" (
|
||||
if "!LOG_BASE!"=="" (
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ elif [ -f "${RABBITMQ_CONFIG_FILE}.conf" ]; then
|
|||
-conf_dir ${RABBITMQ_GENERATED_CONFIG_DIR} \
|
||||
-conf_script_dir `dirname $0` \
|
||||
-conf_schema_dir ${RABBITMQ_HOME}/priv/schema"
|
||||
echo "${RABBITMQ_CONFIG_ADVANCED}.config"
|
||||
if [ -f "${RABBITMQ_CONFIG_ADVANCED}.config" ]; then
|
||||
RABBITMQ_CONFIG_ARG="${RABBITMQ_CONFIG_ARG} \
|
||||
-conf_advanced ${RABBITMQ_CONFIG_ADVANCED} \
|
||||
|
|
|
|||
|
|
@ -803,32 +803,7 @@ home_dir() ->
|
|||
end.
|
||||
|
||||
config_files() ->
|
||||
Abs = fun (F) ->
|
||||
filename:absname(filename:rootname(F, ".config") ++ ".config")
|
||||
end,
|
||||
case init:get_argument(config) of
|
||||
{ok, Files} -> [Abs(File) || [File] <- Files];
|
||||
error -> case config_setting() of
|
||||
none -> [];
|
||||
File -> [Abs(File) ++ " (not found)"]
|
||||
end
|
||||
end.
|
||||
|
||||
%% This is a pain. We want to know where the config file is. But we
|
||||
%% can't specify it on the command line if it is missing or the VM
|
||||
%% will fail to start, so we need to find it by some mechanism other
|
||||
%% than init:get_arguments/0. We can look at the environment variable
|
||||
%% which is responsible for setting it... but that doesn't work for a
|
||||
%% Windows service since the variable can change and the service not
|
||||
%% be reinstalled, so in that case we add a magic application env.
|
||||
config_setting() ->
|
||||
case application:get_env(rabbit, windows_service_config) of
|
||||
{ok, File1} -> File1;
|
||||
undefined -> case os:getenv("RABBITMQ_CONFIG_FILE") of
|
||||
false -> none;
|
||||
File2 -> File2
|
||||
end
|
||||
end.
|
||||
rabbit_config:config_files().
|
||||
|
||||
%% We don't want this in fhc since it references rabbit stuff. And we can't put
|
||||
%% this in the bootstep directly.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
prepare_and_use_config/0,
|
||||
prepare_config/1,
|
||||
update_app_config/1,
|
||||
schema_dir/0]).
|
||||
schema_dir/0,
|
||||
config_files/0
|
||||
]).
|
||||
|
||||
prepare_and_use_config() ->
|
||||
case erlang_config_used() of
|
||||
|
|
@ -28,7 +30,7 @@ prepare_and_use_config() ->
|
|||
erlang_config_used() ->
|
||||
case init:get_argument(config) of
|
||||
error -> false;
|
||||
{ok, Config} ->
|
||||
{ok, [Config | _]} ->
|
||||
ConfigFile = Config ++ ".config",
|
||||
rabbit_file:is_file(ConfigFile)
|
||||
andalso
|
||||
|
|
@ -80,7 +82,6 @@ generate_config_file(ConfFiles, ConfDir, ScriptDir) ->
|
|||
" -e ", "\"", ConfDir, "\"",
|
||||
[[" -c ", ConfFile] || ConfFile <- ConfFiles],
|
||||
AdvancedConfigArg]),
|
||||
io:format("Command: ~s~n", [Command]),
|
||||
Result = rabbit_misc:os_cmd(Command),
|
||||
case string:str(Result, " -config ") of
|
||||
0 -> {error, {generation_error, Result}};
|
||||
|
|
@ -104,7 +105,8 @@ schema_dir() ->
|
|||
|
||||
get_advanced_config() ->
|
||||
case init:get_argument(conf_advanced) of
|
||||
{ok, FileName} ->
|
||||
% There can be only one advanced.config
|
||||
{ok, [FileName | _]} ->
|
||||
ConfigName = FileName ++ ".config",
|
||||
case rabbit_file:is_file(ConfigName) of
|
||||
true -> {ok, ConfigName};
|
||||
|
|
@ -121,4 +123,43 @@ prepare_plugin_schemas(SchemaDir) ->
|
|||
end.
|
||||
|
||||
|
||||
config_files() ->
|
||||
Abs = fun (F, Ex) -> filename:absname(filename:rootname(F, Ex) ++ Ex) end,
|
||||
case erlang_config_used() of
|
||||
true ->
|
||||
case init:get_argument(config) of
|
||||
{ok, Files} -> [Abs(File, ".config") || [File] <- Files];
|
||||
error -> case config_setting() of
|
||||
none -> [];
|
||||
File -> [Abs(File, ".config")
|
||||
++
|
||||
" (not found)"]
|
||||
end
|
||||
end;
|
||||
false ->
|
||||
ConfFiles = [Abs(File, ".conf") || File <- get_confs()],
|
||||
AdvancedFiles = case get_advanced_config() of
|
||||
none -> [];
|
||||
{ok, FileName} -> [Abs(FileName, ".config")]
|
||||
end,
|
||||
AdvancedFiles ++ ConfFiles
|
||||
|
||||
end.
|
||||
|
||||
|
||||
%% This is a pain. We want to know where the config file is. But we
|
||||
%% can't specify it on the command line if it is missing or the VM
|
||||
%% will fail to start, so we need to find it by some mechanism other
|
||||
%% than init:get_arguments/0. We can look at the environment variable
|
||||
%% which is responsible for setting it... but that doesn't work for a
|
||||
%% Windows service since the variable can change and the service not
|
||||
%% be reinstalled, so in that case we add a magic application env.
|
||||
config_setting() ->
|
||||
case application:get_env(rabbit, windows_service_config) of
|
||||
{ok, File1} -> File1;
|
||||
undefined -> case os:getenv("RABBITMQ_CONFIG_FILE") of
|
||||
false -> none;
|
||||
File2 -> File2
|
||||
end
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue