Allow bind address override (#53)

pull/71/head
Christopher Patton 4 years ago committed by GitHub
parent b4165f9957
commit 7ec20ecf46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,23 +3,22 @@
# ./whoogle-search # Runs the full web app
# ./whoogle-search test # Runs the testing suite
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
set -euo pipefail
# Set default port if unavailable
if [[ -z "${PORT}" ]]; then
PORT="${EXPOSE_PORT:-5000}"
fi
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
# Set directory to serve static content from
[[ ! -z $1 ]] && SUBDIR="$1" || SUBDIR="app"
export APP_ROOT=$SCRIPT_DIR/$SUBDIR
export STATIC_FOLDER=$APP_ROOT/static
SUBDIR="${1:-app}"
export APP_ROOT="$SCRIPT_DIR/$SUBDIR"
export STATIC_FOLDER="$APP_ROOT/static"
mkdir -p $STATIC_FOLDER
mkdir -p "$STATIC_FOLDER"
# Check for regular vs test run
if [[ $SUBDIR == "test" ]]; then
if [[ "$SUBDIR" == "test" ]]; then
pytest -sv
else
python3 -um app --host 0.0.0.0 --port $PORT
python3 -um app \
--host "${ADDRESS:-0.0.0.0}" \
--port "${PORT:-"${EXPOSE_PORT:-5000}"}"
fi

Loading…
Cancel
Save