-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·46 lines (40 loc) · 1.01 KB
/
run.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
#!/bin/bash
# Initialize flags
install_flag=false
dev_flag=false
# Print help message
print_help() {
echo "Run the API."
echo " "
echo "Usage: ./run.sh [options]"
echo " "
echo "Options:"
echo "-h show brief help"
echo "-d run in development mode"
echo "-i install dependencies"
exit 0
}
# Parse command line arguments
while getopts 'dih' flag; do
case "${flag}" in
d) dev_flag=true ;;
i) install_flag=true ;;
h) print_help ;;
*) print_help ;;
esac
done
# Move to src directory
cd "$(dirname "$(readlink -f "$0")")/.."
# Run the install script if the flag is set
if [ "$install_flag" = true ]; then
echo "Running install script..."
./scripts/install.sh
fi
# Run API
if [ "$dev_flag" = true ]; then
echo "Running API (Development Mode)..."
pipenv run uvicorn main:api --host localhost --port 8080 --reload
else
echo "Running API (Production Mode)..."
pipenv run uvicorn main:api --workers 4 --host 0.0.0.0 --port 8080
fi