-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·50 lines (42 loc) · 1.22 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
function setConfiguration() {
KEY=$1
VALUE=$2
sed -i "s/\_\_$KEY\_\_/$VALUE/g" /etc/rabbitmq/rabbitmq.config
sed -i "s/\_\_$KEY\_\_/$VALUE/g" /etc/rabbitmq/definitions.json
}
if [ -n "${VHOST_INTERNAL_USERNAME+1}" ]; then
setConfiguration "VHOST_INTERNAL_USERNAME" "$VHOST_INTERNAL_USERNAME"
else
echo "VHOST_INTERNAL_USERNAME is needed."
exit 1
fi
if [ -n "${VHOST_DEFAULT_USERNAME+1}" ]; then
setConfiguration "VHOST_DEFAULT_USERNAME" "$VHOST_DEFAULT_USERNAME"
else
echo "VHOST_DEFAULT_USERNAME is needed."
exit 1
fi
if [ -n "${VHOST_INTERNAL_PASSWORD+1}" ]; then
setConfiguration "VHOST_INTERNAL_PASSWORD" "$VHOST_INTERNAL_PASSWORD"
else
echo "VHOST_INTERNAL_PASSWORD is needed."
exit 1
fi
if [ -n "${VHOST_DEFAULT_PASSWORD+1}" ]; then
setConfiguration "VHOST_DEFAULT_PASSWORD" "$VHOST_DEFAULT_PASSWORD"
else
echo "VHOST_DEFAULT_PASSWORD is needed."
exit 1
fi
if [ -n "${IO_BARRACKS_RABBITMQAUTHSERVICE_BASE_URL+1}" ]; then
setConfiguration "IO_BARRACKS_RABBITMQAUTHSERVICE_BASE_URL" "$IO_BARRACKS_RABBITMQAUTHSERVICE_BASE_URL"
else
echo "IO_BARRACKS_RABBITMQAUTHSERVICE_BASE_URL is needed."
exit 1
fi
if [ "$1" = 'rabbitmq-server' ]; then
exec rabbitmq-server "$@"
fi
exec "$@"