-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·38 lines (36 loc) · 860 Bytes
/
Copy pathstart.sh
File metadata and controls
executable file
·38 lines (36 loc) · 860 Bytes
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
#!/bin/bash
export FLASK_APP="api/__init__.py"
export DATABASE_URL="postgresql://localhost/tableflip"
PG_LOG="postgres.log"
[[ -f .env ]] && export $(cat .env | xargs)
if [ "$(uname)" != "Linux" ]; then
# Start Postgres if your OS doesn't handle that for you
if pg_ctl status -D "$PG_DIR" ; then
echo "[postgres already running]"
else
echo "Starting postgres..."
pg_ctl start -D "$PG_DIR" -l "$PG_LOG"
echo " -> SUCCESS. logs in $PG_LOG"
fi
fi
case "$1" in
"web")
(cd web && npm run dev)
;;
"api")
source venv/bin/activate
exec flask run --with-threads -p ${FLASK_PORT:-5000}
;;
"shell")
source venv/bin/activate
flask shell
;;
"engine")
exec engine/start.sh
;;
"psql")
psql $DATABASE_URL
;;
*)
echo "Usage: ./start.sh [all|web|api|shell|engine|psql]"
esac