Use env var for PROD_PORT

This commit is contained in:
Sage Vaillancourt 2022-10-03 20:37:56 +00:00
parent c26758f468
commit a407f3228c
1 changed files with 9 additions and 1 deletions

10
start
View File

@ -2,6 +2,8 @@
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source ./env
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
if ! "$SCRIPT_DIR/init"; then if ! "$SCRIPT_DIR/init"; then
exit 1 exit 1
@ -13,9 +15,15 @@ if ! pip3 -V | grep -E "$SCRIPT_DIR/\.?venv"; then
source "$SCRIPT_DIR/.venv/bin/activate" source "$SCRIPT_DIR/.venv/bin/activate"
fi fi
PROD_PORT=8080
if [[ "$UNDERCOVER_PROD_PORT" != "" ]]; then
PROD_PORT="$UNDERCOVER_PROD_PORT"
fi
if [[ "$1" == "prod" ]]; then if [[ "$1" == "prod" ]]; then
echo "Starting gunicorn production server..." echo "Starting gunicorn production server..."
gunicorn -b localhost:8080 "app:create_app()" gunicorn -b localhost:$PROD_PORT "app:create_app()"
else else
echo "Starting local dev server..." echo "Starting local dev server..."
export FLASK_APP=app export FLASK_APP=app