-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathboot.sh
More file actions
39 lines (29 loc) · 1.22 KB
/
boot.sh
File metadata and controls
39 lines (29 loc) · 1.22 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
#!/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*' -print0 |
xargs -0 sed -i "s@AAAABBBBCCCC@${ENGINE_URL}@g"
find /usr/share/nginx/engine -type f -name 'index*.js*' -print0 |
xargs -0 sed -i "s@DDDDEEEEFFFF@${BASE_URL}@g"
find /usr/share/nginx/engine -type f -exec grep -q "GGGGHHHHIIIIJJJJ" {} \; -print0 |
xargs -0 -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