2021-07-28 22:52:37 -04:00
|
|
|
#!/bin/bash
|
2022-09-23 13:37:37 -04:00
|
|
|
|
2021-07-28 22:52:37 -04:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
|
2021-07-28 23:25:29 -04:00
|
|
|
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
|
2022-09-22 16:11:26 -04:00
|
|
|
if ! "$SCRIPT_DIR/init"; then
|
2021-07-28 23:25:29 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-09-23 13:37:37 -04:00
|
|
|
if ! pip3 -V | grep -E "$SCRIPT_DIR/\.?venv"; then
|
2021-07-28 22:52:37 -04:00
|
|
|
echo "Entering virtual environment..."
|
2022-09-22 16:11:26 -04:00
|
|
|
source "$SCRIPT_DIR/.venv/bin/activate"
|
2021-07-28 22:52:37 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$1" == "prod" ]]; then
|
|
|
|
echo "Starting gunicorn production server..."
|
2022-09-24 21:12:32 -04:00
|
|
|
gunicorn -b 0.0.0.0:80 -b 0.0.0.0:443 "undercover:create_app()"
|
2021-07-28 22:52:37 -04:00
|
|
|
else
|
|
|
|
echo "Starting local dev server..."
|
2022-09-23 11:35:56 -04:00
|
|
|
export FLASK_APP=undercover
|
2022-09-26 17:00:21 -04:00
|
|
|
flask --debug run --host=0.0.0.0
|
2021-07-28 22:52:37 -04:00
|
|
|
fi
|