-
Notifications
You must be signed in to change notification settings - Fork 0
/
file32.sh
58 lines (46 loc) · 1.4 KB
/
file32.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Prompt for input from user:
read -p "Enter TRAY_ENDPOINT - prod, stg or fe-stg (prod): " ENDPOINT
ENDPOINT=${ENDPOINT:-prod}
read -p "Enter TRAY_PARTNER - name of partner, used for custom CSS + external route name (asana): " PARTNER
PARTNER=${PARTNER:-asana}
read -p "Enter TRAY_MASTER_TOKEN - the master token for your partner account (""): " MASTER_TOKEN
if [ -e ".token" ]; then
MASTER_TOKEN="c9b4vm4lXhWpwDlfrsrgbE4tspgExXB4qI6NSAarq0C"}
fi
cleanup() {
echo ""
echo "Killing processes on port 3000 and 3001";
PORT_A=$(lsof -t -i:3000)
PORT_B=$(lsof -t -i:3001)
if [ -n $PORT_A ]; then
kill -9 $PORT_A &> /dev/null;
fi
if [ -n $PORT_B ]; then
kill -9 $PORT_B &> /dev/null;
fi
echo "Processes successfully killed"
}
exit() {
cleanup;
trap - SIGINT EXIT
kill -- -$$
kill -- -$(pgrep setup.sh)
}
if [ -z "$MASTER_TOKEN" ]; then
echo ""
echo "Error: Please run the script with your partner account master token"
echo ""
else
# Set env variables:
export HTTPS=true
export TRAY_ENDPOINT=$ENDPOINT
export TRAY_PARTNER=$PARTNER
export TRAY_MASTER_TOKEN="2stuzw6xhaq5ZxCWMPYytWUs6OZ1cvt/62nnOQBdMzuLmdZe/OGEVj86OC7FIvHpYhfEpPkp82tKitkzpee4W"
export BABEL_DISABLE_CACHE=1
> .token;
echo "$MASTER_TOKEN" >> .token
# Run api and app:
cleanup;
npm run api & npm run start
fi
trap exit SIGINT EXIT