forked from SUNET/docker-svs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·47 lines (33 loc) · 1.04 KB
/
start.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
#!/usr/bin/env bash
# for Click library to work in satosa-saml-metadata
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# exit immediately on failure
set -e
if [ -z "${DATA_DIR}" ]; then
DATA_DIR=/var/svs
fi
if [ ! -d "${DATA_DIR}" ]; then
mkdir -p "${DATA_DIR}"
fi
if [ -z "${PROXY_PORT}" ]; then
PROXY_PORT="80"
fi
if [ -z "${METADATA_DIR}" ]; then
METADATA_DIR="${DATA_DIR}"
fi
cd ${DATA_DIR}
mkdir -p ${METADATA_DIR}
if [ ! -d ${DATA_DIR}/attributemaps ]; then
cp -pr /tmp/inacademia/attributemaps ${DATA_DIR}/attributemaps
fi
# generate metadata for front- (IdP) and back-end (SP) and write it to mounted volume
satosa-saml-metadata proxy_conf.yaml ${DATA_DIR}/metadata.key ${DATA_DIR}/metadata.crt --dir ${METADATA_DIR}
# start the rsyslog service
service rsyslog start
# start the proxy
if [[ -f https.key && -f https.crt ]]; then # if HTTPS cert is available, use it
exec gunicorn --reload -b0.0.0.0:${PROXY_PORT} --keyfile https.key --certfile https.crt satosa.wsgi:app
else
exec gunicorn -b0.0.0.0:${PROXY_PORT} satosa.wsgi:app
fi