-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
50 lines (42 loc) · 1.21 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
##################
# Add admin user #
##################
if [ $KEYCLOAK_USER ] && [ $KEYCLOAK_PASSWORD ]; then
sh /keycloak/bin/add-user-keycloak.sh --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD
fi
###################
# Operating Modes #
###################
# Lower case OPERATING_MODE
OPERATING_MODE=`echo $OPERATING_MODE | tr A-Z a-z`
# Default to standalone if OPERATING_MODE not detected
if [ "$OPERATING_MODE" == "" ]; then
OPERATING_MODE="standalone"
fi
STANDALONE_BOOT_SCRIPT='standalone.sh'
DOMAIN_BOOT_SCRIPT='domain.sh'
case "$OPERATING_MODE" in
standalone)
BOOT_SCRIPT="$STANDALONE_BOOT_SCRIPT"
if [ "$BOOT_PARAMETERS" == "" ]; then
export BOOT_PARAMETERS="-b 0.0.0.0"
fi
;;
standalone_clustered)
BOOT_SCRIPT="$STANDALONE_BOOT_SCRIPT";;
domain_master)
BOOT_SCRIPT="$DOMAIN_BOOT_SCRIPT";;
domain_slave)
BOOT_SCRIPT="$DOMAIN_BOOT_SCRIPT";;
*)
echo "Unknown operating mode $OPERATING_MODE"
exit 1
esac
##################
# Start Keycloak #
##################
echo "Operating mode $OPERATING_MODE"
echo "Booting up Keycloak with the following parameters $BOOT_PARAMETERS"
exec sh /keycloak/bin/$BOOT_SCRIPT $BOOT_PARAMETERS
exit $?