-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathboot.sh
More file actions
36 lines (30 loc) · 1.14 KB
/
boot.sh
File metadata and controls
36 lines (30 loc) · 1.14 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
#!/bin/sh
if [ -z ${ENGINE_URL+x} ]
then
echo "ENGINE_URL is unset, using default /api"
export ENGINE_URL=/api
fi
if [ -z ${BASE_URL+x} ]
then
echo "BASE_URL is unset, using default /"
export BASE_URL=/
fi
if [ -z ${ENGINE_HTTP_PORT+x} ]
then
echo "ENGINE_HTTP_PORT is unset, using default 80"
export ENGINE_HTTP_PORT=80
fi
if [ "$DISABLE_REQUEST_LIMIT" == "true" ]
then
echo "DISABLE_REQUEST_LIMIT is set to true, disabling request limiting"
sed -i '/^limit_req/d' /etc/nginx/conf.d/default.conf
fi
if [ -n ${mount_url+x} ] && [ "$mount_url" != "" ] && [ "$mount_url" != "/" ] && [ "$mount_url" != "/engine" ]
then
ln -s /usr/share/nginx/engine /usr/share/nginx${mount_url}
fi
BASE_URL_STRIPPED=$(echo ${BASE_URL} | sed -e 's@/$@@g')
find /usr/share/nginx/engine -type f -name 'index*.js*' | xargs sed -i "s@AAAABBBBCCCC@${ENGINE_URL}@g"
find /usr/share/nginx/engine -type f -name 'index*.js*' | xargs sed -i "s@DDDDEEEEFFFF@${BASE_URL}@g"
grep -lr "GGGGHHHHIIIIJJJJ" /usr/share/nginx/engine | xargs -r sed -i "s@/GGGGHHHHIIIIJJJJ@${BASE_URL_STRIPPED}@g"
sed -i -E "s/listen [0-9]+;/listen ${ENGINE_HTTP_PORT};/" /etc/nginx/conf.d/default.conf