forked from kartoza/docker-mapproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·35 lines (31 loc) · 991 Bytes
/
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
#!/bin/bash
# Check if uwsgi configuration exists
if [[ ! -f /settings/uwsgi.ini ]]; then
echo "/settings/uwsgi.ini doesn't exists"
# If it doesn't exists, copy from /mapproxy directory if exists
if [[ -f /mapproxy/uwsgi.ini ]]; then
cp -f /mapproxy/uwsgi.ini /settings/uwsgi.ini
else
# default value
envsubst < /settings/uwsgi.default.ini > /settings/uwsgi.ini
fi
fi
# Create a default mapproxy config is one does not exist in /mapproxy
if [ ! -f /mapproxy/mapproxy.yaml ]
then
mapproxy-util create -t base-config mapproxy
fi
cd /mapproxy
# Add logic to reload the app file
mapproxy-util create -t wsgi-app -f mapproxy.yaml /mapproxy/app.py
RELOAD_LOCKFILE=/settings/.app.lock
if [[ ! -f ${RELOAD_LOCKFILE} ]];then
sed -i 's/\(, reloader=True\)*'\)'/, reloader=True\)/g' app.py
touch ${RELOAD_LOCKFILE}
fi
#su $USER_NAME -c "uwsgi --ini /uwsgi.conf"
if [[ ${PRODUCTION} =~ [Tt][Rr][Uu][Ee] ]]; then
exec uwsgi --ini /settings/uwsgi.ini
else
exec "$@"
fi