whoogle-search/run

25 lines
548 B
Plaintext
Raw Normal View History

#!/bin/bash
# Usage:
# ./run # Runs the full web app
# ./run test # Runs the testing suite
2020-05-15 22:36:01 +00:00
set -euo pipefail
2020-05-15 22:36:01 +00:00
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# Set directory to serve static content from
2020-05-15 22:36:01 +00:00
SUBDIR="${1:-app}"
export APP_ROOT="$SCRIPT_DIR/$SUBDIR"
export STATIC_FOLDER="$APP_ROOT/static"
2020-05-15 22:36:01 +00:00
mkdir -p "$STATIC_FOLDER"
# Check for regular vs test run
2020-05-15 22:36:01 +00:00
if [[ "$SUBDIR" == "test" ]]; then
pytest -sv
else
2020-05-15 22:36:01 +00:00
python3 -um app \
--host "${ADDRESS:-0.0.0.0}" \
--port "${PORT:-"${EXPOSE_PORT:-5000}"}"
fi