forked from Alen-QK/VanManga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_config_js.sh
28 lines (22 loc) · 825 Bytes
/
create_config_js.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
#!/bin/bash
SRC="/vanmanga/frontend/static/js/config.js"
if [ -z $SRC ] || [ ! -e "$SRC" ]; then
echo "Source file '$SRC' does not exist"
exit 1
fi
OUTPUT="// generated"
while IFS="" read -r line || [ -n "$line" ]; do
use_line=$line
if [[ $line =~ "window." ]]; then
ENVIRONMENT_VARIABLE_NAME=`echo $line | sed -re 's/window\.(.*)\s+\=(.*);/\1/g'`
ENVIRONMENT_VARIABLE_NAME="${ENVIRONMENT_VARIABLE_NAME/$'\r'/}"
value=${!ENVIRONMENT_VARIABLE_NAME}
if [[ ${value} && ${value-x} ]]; then
use_line="window.$ENVIRONMENT_VARIABLE_NAME = '$value';"
echo "$use_line"
fi
fi
OUTPUT="$OUTPUT\n$use_line"
done <$SRC
echo -en $"$OUTPUT" > "$SRC"
gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:5000 main:app