-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
122 lines (96 loc) · 3.65 KB
/
Copy pathdocker-entrypoint.sh
File metadata and controls
122 lines (96 loc) · 3.65 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
set -eu
echo "Version 2018.10.31.02"
# set -x
echo "Running setenv.sh"
./setenv.sh
if [[ ! -z "${SQLSERVER_USER:-}" ]] || [[ ! -z "${SQLSERVER_USER_FILE:-}" ]]
then
echo "SQLSERVER_USER is set so switching Mirth to use MS SQL Server"
if [[ ! -z "${SQLSERVER_USER_FILE:-}" ]]
then
echo "SQLSERVER_USER_FILE is set so reading from $SQLSERVER_USER_FILE"
SQLSERVER_USER=$(cat $SQLSERVER_USER_FILE)
fi
if [[ -z "${SQLSERVER_USER:-}" ]]; then
echo "SQLSERVER_USER must be specified"
exit 1
fi
if [[ ! -z "${SQLSERVER_PASSWORD_FILE:-}" ]]
then
echo "SQLSERVER_PASSWORD_FILE is set so reading from $SQLSERVER_PASSWORD_FILE"
SQLSERVER_PASSWORD=$(cat $SQLSERVER_PASSWORD_FILE)
fi
if [[ -z "${SQLSERVER_PASSWORD:-}" ]]; then
echo "SQLSERVER_PASSWORD must be specified"
exit 1
fi
if [[ ! -z "${SQLSERVER_DOMAIN_FILE:-}" ]]
then
echo "SQLSERVER_DOMAIN_FILE is set so reading from $SQLSERVER_DOMAIN_FILE"
SQLSERVER_DOMAIN=$(cat $SQLSERVER_DOMAIN_FILE)
fi
if [[ -z "${SQLSERVER_DOMAIN:-}" ]]; then
echo "SQLSERVER_DOMAIN must be specified"
exit 1
fi
if [[ ! -z "${SQLSERVER_AD_URL_FILE:-}" ]]
then
echo "SQLSERVER_AD_URL_FILE is set so reading from $SQLSERVER_AD_URL_FILE"
SQLSERVER_AD_URL=$(cat $SQLSERVER_AD_URL_FILE)
fi
if [[ -z "${SQLSERVER_AD_URL:-}" ]]; then
echo "SQLSERVER_AD_URL must be specified"
exit 1
fi
if [[ ! -z "${SQLSERVER_SERVER_FILE:-}" ]]
then
echo "SQLSERVER_SERVER_FILE is set so reading from $SQLSERVER_SERVER_FILE"
SQLSERVER_SERVER=$(cat $SQLSERVER_SERVER_FILE)
fi
if [[ -z "${SQLSERVER_SERVER:-}" ]]; then
echo "SQLSERVER_SERVER must be specified"
exit 1
fi
if [[ ! -z "${SQLSERVER_DATABASE_FILE:-}" ]]
then
echo "SQLSERVER_DATABASE_FILE is set so reading from $SQLSERVER_DATABASE_FILE"
SQLSERVER_DATABASE=$(cat $SQLSERVER_DATABASE_FILE)
fi
if [[ -z "${SQLSERVER_DATABASE:-}" ]]; then
echo "SQLSERVER_DATABASE must be specified"
exit 1
fi
# now run with all the parameters
/opt/mirthconnect_database/switchtosqlserver.sh ${SQLSERVER_USER} ${SQLSERVER_PASSWORD} ${SQLSERVER_DOMAIN} ${SQLSERVER_AD_URL} ${SQLSERVER_SERVER} ${SQLSERVER_PORT:-1433} ${SQLSERVER_DATABASE}
else
if [[ ! -z "${MYSQL_USER:-}" ]]; then
echo "$MYSQL_USER is set so switching Mirth to use MySql"
/opt/mirthconnect_mysql/switchtomysql.sh
fi
fi
if [[ ! -z "${HTTP_PORT:-}" ]]; then
echo "HTTP_PORT is set so switching Mirth to use $HTTP_PORT"
replaceconfig "http.port" "$HTTP_PORT" /opt/mirthconnect/conf/mirth.properties
fi
if [[ ! -z "${HTTPS_PORT:-}" ]]; then
echo "HTTPS_PORT is set so switching Mirth to use $HTTPS_PORT"
replaceconfig "https.port" "$HTTPS_PORT" /opt/mirthconnect/conf/mirth.properties
fi
if [[ ! -z "${HTTP_CONTEXTPATH:-}" ]]; then
echo "HTTP_CONTEXTPATH is set so switching Mirth to use $HTTP_CONTEXTPATH"
replaceconfig "http.contextpath" "$HTTP_CONTEXTPATH" /opt/mirthconnect/conf/mirth.properties
fi
if [[ ! -z "${SERVER_HOSTNAME:-}" ]]; then
url="http://${SERVER_HOSTNAME}:${HTTP_PORT}${HTTP_CONTEXTPATH}"
echo "SERVER_HOSTNAME is set so switching Mirth to use url: $url"
replaceconfig "server.url" "$url" /opt/mirthconnect/conf/mirth.properties
fi
echo "--- mirth.properties ---"
cat /opt/mirthconnect/conf/mirth.properties
echo "--------------------------"
/opt/mirthconnect/startmirthandrenewcredentials.sh
mkdir -p /opt/healthcatalyst
touch /opt/healthcatalyst/ready
echo "starting Mirth for real"
exec "$@"