forked from bitfinexcom/bfx-reports-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·108 lines (89 loc) · 2.87 KB
/
init.sh
File metadata and controls
executable file
·108 lines (89 loc) · 2.87 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
export NODE_PATH=src/
export PUBLIC_URL=/
export REACT_APP_PLATFORM=localhost
export REACT_APP_TITLE=Bitfinex Reports
export REACT_APP_LOGO_PATH=favicon.ico
programname=$0
isDevEnv=0
ip=0
function usage {
echo "Usage: $programname [-d] | [-i] | [-u] | [-h]"
echo " -d turn on developer environment"
echo " -i=XX.XX.XX.XX adds ip as to run on an external network"
echo " -u=URL adds URL as to run on an external network"
echo " -h display help"
exit 1
}
while [ "$1" != "" ]; do
case $1 in
-d | --dev ) isDevEnv=1
;;
-i | --ip ) shift
ip=$1
;;
-u | --url ) shift
ip=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
if [ $isDevEnv != 0 ]; then
echo "Developer environment is turned on"
fi
if [ $ip != 0 ]; then
echo "Ip is set to: $ip"
fi
frontendFolder="$PWD/bfx-report-ui"
expressFolder="$frontendFolder/bfx-report-express"
backendFolder="$PWD"
cd $frontendFolder
git stash
cd $backendFolder
git submodule sync
git submodule update --init --recursive
git pull --recurse-submodules
git submodule update --remote
npm i
cd $expressFolder
git submodule sync
git submodule update --init --recursive
git pull --recurse-submodules
git submodule update --remote
git stash
cd $frontendFolder
git submodule sync
git submodule update --init --recursive
git pull --recurse-submodules
git submodule update --remote
npm i
if [ $isDevEnv != 0 ]; then
sed -i -e "s/KEY_URL: .*,/KEY_URL: \'https:\/\/test.bitfinex.com\/api\',/g" $frontendFolder/src/var/config.js
fi
if [ $ip != 0 ]; then
sed -i -e "s/API_URL: .*,/API_URL: \'http:\/\/$ip:31339\/api\',/g" $frontendFolder/src/var/config.js
sed -i -e "s/HOME_URL: .*,/HOME_URL: \'http:\/\/$ip:3000\',/g" $frontendFolder/src/var/config.js
fi
cp $expressFolder/config/default.json.example $expressFolder/config/default.json
sed -i -e "s/showSyncMode: .*,/showSyncMode: true,/g" $frontendFolder/src/var/config.js
sed -i -e "s/showFrameworkMode: .*,/showFrameworkMode: true,/g" $frontendFolder/src/var/config.js
cd $expressFolder
npm i
cd $backendFolder
cp .env.example bfx-report-ui/.env
cp config/schedule.json.example config/schedule.json
cp config/common.json.example config/common.json
cp config/service.report.json.example config/service.report.json
cp config/facs/grc.config.json.example config/facs/grc.config.json
sed -i -e "s/\"syncMode\": false/\"syncMode\": true/g" $backendFolder/config/service.report.json
if [ $isDevEnv != 0 ]; then
sed -i -e "s/\"restUrl\": .*,/\"restUrl\": \"https:\/\/test.bitfinex.com\",/g" $backendFolder/config/service.report.json
fi
touch db/lokue_queue_1_aggregator.db.json
touch db/lokue_queue_1_processor.db.json
touch db/db-sqlite_sync_m0.db