Skip to content

Commit 6a95e08

Browse files
committed
Correction from given feedback about the code placement
1 parent 9129b73 commit 6a95e08

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

alpine/docker-entrypoint.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ file_env() {
2323
unset "$fileVar"
2424
}
2525

26-
file_env 'RABBITMQ_DEFAULT_USER'
27-
file_env 'RABBITMQ_DEFAULT_PASS'
28-
2926
# allow the container to be started with `--user`
3027
if [[ "$1" == rabbitmq* ]] && [ "$(id -u)" = '0' ]; then
3128
if [ "$1" = 'rabbitmq-server' ]; then
@@ -44,6 +41,12 @@ fi
4441
: "${RABBITMQ_MANAGEMENT_SSL_CERTFILE:=$RABBITMQ_SSL_CERTFILE}"
4542
: "${RABBITMQ_MANAGEMENT_SSL_KEYFILE:=$RABBITMQ_SSL_KEYFILE}"
4643

44+
# Allowed env vars that will be read from mounted files (i.e. Docker Secrets):
45+
fileEnvKeys=(
46+
default_user
47+
default_pass
48+
)
49+
4750
# https://www.rabbitmq.com/configure.html
4851
sslConfigKeys=(
4952
cacertfile
@@ -86,6 +89,7 @@ declare -A configDefaults=(
8689
haveConfig=
8790
haveSslConfig=
8891
haveManagementSslConfig=
92+
for fileEnvKey in "${fileEnvKeys[@]}"; do file_env "RABBITMQ_${fileEnvKey^^}"; done
8993
for conf in "${allConfigKeys[@]}"; do
9094
var="RABBITMQ_${conf^^}"
9195
val="${!var:-}"

debian/docker-entrypoint.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ file_env() {
2323
unset "$fileVar"
2424
}
2525

26-
file_env 'RABBITMQ_DEFAULT_PASS'
27-
2826
# allow the container to be started with `--user`
2927
if [[ "$1" == rabbitmq* ]] && [ "$(id -u)" = '0' ]; then
3028
if [ "$1" = 'rabbitmq-server' ]; then
@@ -43,6 +41,12 @@ fi
4341
: "${RABBITMQ_MANAGEMENT_SSL_CERTFILE:=$RABBITMQ_SSL_CERTFILE}"
4442
: "${RABBITMQ_MANAGEMENT_SSL_KEYFILE:=$RABBITMQ_SSL_KEYFILE}"
4543

44+
# Allowed env vars that will be read from mounted files (i.e. Docker Secrets):
45+
fileEnvKeys=(
46+
default_user
47+
default_pass
48+
)
49+
4650
# https://www.rabbitmq.com/configure.html
4751
sslConfigKeys=(
4852
cacertfile
@@ -85,6 +89,7 @@ declare -A configDefaults=(
8589
haveConfig=
8690
haveSslConfig=
8791
haveManagementSslConfig=
92+
for fileEnvKey in "${fileEnvKeys[@]}"; do file_env "RABBITMQ_${fileEnvKey^^}"; done
8893
for conf in "${allConfigKeys[@]}"; do
8994
var="RABBITMQ_${conf^^}"
9095
val="${!var:-}"

0 commit comments

Comments
 (0)