#! /bin/bash
pytest --disable-warnings
python ./scripts/create_database.py

EXPECTED_VALUE="test"

if [ -z "$ENVIRON" ]; then
  echo "ENVIRON is not set."
else
    echo "ENVIRON is set to: $ENVIRON"

  # Trim leading and trailing whitespaces
  ACTUAL_VALUE=$(echo "$ENVIRON" | tr -d '[:space:]')

  if [ "$ACTUAL_VALUE" = "$EXPECTED_VALUE" ]; then
    echo "Launching DEV Server"
    python ./app.py 
  else
    echo "Launching PROD Server"
    waitress-serve --host 0.0.0.0 app:app
  fi
fi


