-
Notifications
You must be signed in to change notification settings - Fork 0
/
setenv.sh
48 lines (43 loc) · 1.49 KB
/
setenv.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
#!/bin/bash
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env 'LDAP_ROOTPASS' 'secret'
file_env 'MYSQL_USER' 'pacs'
file_env 'MYSQL_PASSWORD' 'pacs'
file_env 'KEYSTORE_PASSWORD' 'secret'
file_env 'KEY_PASSWORD' "${KEYSTORE_PASSWORD}"
file_env 'TRUSTSTORE_PASSWORD' 'changeit'
file_env 'EXTRA_CACERTS_PASSWORD' 'secret'
file_env 'WILDFLY_ADMIN_USER'
file_env 'WILDFLY_ADMIN_PASSWORD'
# Append '?' in the beginning of the string if MYSQL_JDBC_PARAMS value isn't empty
MYSQL_JDBC_PARAMS=$(echo ${MYSQL_JDBC_PARAMS} | sed '/^$/! s/^/?/')
if [ $LOGSTASH_HOST ]; then
SYS_PROPS="-c dcm4chee-arc-logstash.xml"
else
SYS_PROPS="-c dcm4chee-arc.xml"
fi
SYS_PROPS+=" -Djboss.management.http.port=${MANAGEMENT_HTTP_PORT:-9990}"
SYS_PROPS+=" -Djboss.management.https.port=${MANAGEMENT_HTTPS_PORT:-9993}"
SYS_PROPS+=" -Djboss.http.port=${HTTP_PORT:-8080}"
SYS_PROPS+=" -Djboss.https.port=${HTTPS_PORT:-8443}"
SYS_PROPS+=" -Djboss.redirect.https.port=${REDIRECT_HTTPS_PORT:-8443}"