Allow bind address override (#53)

main
Christopher Patton 2020-05-15 15:36:01 -07:00 committed by GitHub
parent b4165f9957
commit 7ec20ecf46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -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