-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch
More file actions
executable file
·59 lines (52 loc) · 1.39 KB
/
launch
File metadata and controls
executable file
·59 lines (52 loc) · 1.39 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
#!/usr/bin/env bash
set -e
get_free_port() {
python3.10 <<END
import socket
sock = socket.socket()
sock.bind(("", 0))
print(sock.getsockname()[1])
END
}
usage() {
echo "Usage: $0 [-t <stub_file_Path>] [-a <backend-host>] [-u <user-port>] [-d <data-port>] [-g <user-frondend--port>] [-m <data-frontend-port>]"
1>&2; exit 1;
}
BACKEND_HOST="ws://172.17.0.2"
USER_PORT=`get_free_port`
DATA_PORT=`get_free_port`
USER_FRONTEND_PORT=`get_free_port`
DATA_FRONTEND_PORT=`get_free_port`
while getopts ":t:a:u:d:g:m:" flag
do
case "${flag}" in
t) STUB=${OPTARG};;
a) BACKEND_HOST=${OPTARG};;
u) USER_PORT=${OPTARG};;
d) DATA_PORT=${OPTARG};;
g) USER_FRONTEND_PORT=${OPTARG};;
m) DATA_FRONTEND_PORT=${OPTARG};;
*) usage;;
esac
done
export BACKEND_HOST
export USER_PORT
export DATA_PORT
export USER_FRONTEND_PORT
export DATA_FRONTEND_PORT
if [ ${STUB+x} ]; then
case $STUB in
/*) STUB_PATH=$STUB;;
*) STUB_PATH=$(pwd)/$STUB;;
esac
(trap 'kill 0' SIGINT; \
(cd frontend ; yarn && yarn start) & \
(cd mockpatient ; yarn && yarn start) & \
(cd backend ; python3.10 middleware.py --data-port $DATA_PORT --user-port $USER_PORT --stub $STUB_PATH)
)
else
(trap 'kill 0' SIGINT; \
(cd frontend ; yarn && yarn start) & \
(cd mockpatient ; yarn && yarn start) & \
(cd backend ; python3.10 middleware.py --data-port $DATA_PORT --user-port $USER_PORT))
fi