Skip to content

Commit 811b0d9

Browse files
author
Daniil Fedotov
committed
Override CONF_ENV_FILE with RABBITMQ_CONF_ENV_FILE
1 parent 81fde9e commit 811b0d9

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

scripts/rabbitmq-defaults.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,4 @@ REM PLUGINS_DIR="${RABBITMQ_HOME}/plugins"
4646
for /f "delims=" %%F in ("!TDP0!..\plugins") do set PLUGINS_DIR=%%~dpsF%%~nF%%~xF
4747

4848
REM CONF_ENV_FILE=${SYS_PREFIX}/etc/rabbitmq/rabbitmq-env.conf
49-
if "!RABBITMQ_CONF_ENV_FILE!"=="" (
50-
set RABBITMQ_CONF_ENV_FILE=!RABBITMQ_BASE!\rabbitmq-env-conf.bat
51-
)
49+
set CONF_ENV_FILE=!RABBITMQ_BASE!\rabbitmq-env-conf.bat

scripts/rabbitmq-env

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,15 @@ RABBITMQ_HOME="$(rmq_realpath "${RABBITMQ_SCRIPTS_DIR}/..")"
6565
## Common defaults
6666
SERVER_ERL_ARGS="+P 1048576"
6767

68-
# warn about old rabbitmq.conf file, if no new one
69-
if [ -f /etc/rabbitmq/rabbitmq.conf ] && \
70-
[ ! -f ${CONF_ENV_FILE} ] ; then
71-
echo -n "WARNING: ignoring /etc/rabbitmq/rabbitmq.conf -- "
72-
echo "location has moved to ${CONF_ENV_FILE}"
73-
fi
74-
7568
# We save the current value of $RABBITMQ_PID_FILE in case it was set by
7669
# an init script. If $CONF_ENV_FILE overrides it again, we must ignore
7770
# it and warn the user.
7871
saved_RABBITMQ_PID_FILE=$RABBITMQ_PID_FILE
7972

8073
## Get configuration variables from the configure environment file
81-
[ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true
74+
[ "x" = "x$RABBITMQ_CONF_ENV_FILE" ] && RABBITMQ_CONF_ENV_FILE=${CONF_ENV_FILE}
75+
76+
[ -f ${RABBITMQ_CONF_ENV_FILE} ] && . ${RABBITMQ_CONF_ENV_FILE} || true
8277

8378
if [ "$saved_RABBITMQ_PID_FILE" -a \
8479
"$saved_RABBITMQ_PID_FILE" != "$RABBITMQ_PID_FILE" ]; then

scripts/rabbitmq-env.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ REM set SERVER_ERL_ARGS=+P 1048576
4747

4848
REM ## Get configuration variables from the configure environment file
4949
REM [ -f ${CONF_ENV_FILE} ] && . ${CONF_ENV_FILE} || true
50+
if "!RABBITMQ_CONF_ENV_FILE!"=="" (
51+
set RABBITMQ_CONF_ENV_FILE=!CONF_ENV_FILE!
52+
)
53+
5054
if exist "!RABBITMQ_CONF_ENV_FILE!" (
5155
call "!RABBITMQ_CONF_ENV_FILE!"
5256
)

scripts/rabbitmq-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ check_not_empty() {
187187
eval value=\$$name
188188
if [ -z "$value" ]; then
189189
echo "Error: ENV variable should be defined: $1.
190-
Please check rabbitmq-env, rabbitmq-defaults, and $CONF_ENV_FILE script files"
190+
Please check rabbitmq-env, rabbitmq-defaults, and ${RABBITMQ_CONF_ENV_FILE} script files"
191191
exit 78
192192
fi
193193
}

0 commit comments

Comments
 (0)