Allow bind address override (#53)
parent
b4165f9957
commit
7ec20ecf46
|
@ -3,23 +3,22 @@
|
||||||
# ./whoogle-search # Runs the full web app
|
# ./whoogle-search # Runs the full web app
|
||||||
# ./whoogle-search test # Runs the testing suite
|
# ./whoogle-search test # Runs the testing suite
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
set -euo pipefail
|
||||||
|
|
||||||
# Set default port if unavailable
|
SCRIPT_DIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
if [[ -z "${PORT}" ]]; then
|
|
||||||
PORT="${EXPOSE_PORT:-5000}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set directory to serve static content from
|
# Set directory to serve static content from
|
||||||
[[ ! -z $1 ]] && SUBDIR="$1" || SUBDIR="app"
|
SUBDIR="${1:-app}"
|
||||||
export APP_ROOT=$SCRIPT_DIR/$SUBDIR
|
export APP_ROOT="$SCRIPT_DIR/$SUBDIR"
|
||||||
export STATIC_FOLDER=$APP_ROOT/static
|
export STATIC_FOLDER="$APP_ROOT/static"
|
||||||
|
|
||||||
mkdir -p $STATIC_FOLDER
|
mkdir -p "$STATIC_FOLDER"
|
||||||
|
|
||||||
# Check for regular vs test run
|
# Check for regular vs test run
|
||||||
if [[ $SUBDIR == "test" ]]; then
|
if [[ "$SUBDIR" == "test" ]]; then
|
||||||
pytest -sv
|
pytest -sv
|
||||||
else
|
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
|
fi
|
||||||
|
|
Loading…
Reference in New Issue