#!/usr/bin/env bash # Rebuild and run the query service in the foreground. # # It mirrors the index and serves the browser. This terminal is quiet by # design: if it is saying anything other than that it seeded, something # upstream is wrong. set -euo pipefail cd "$(dirname "$0")/.." . "$(dirname "$0")/dev-watch.sh" PORT="${VIBESCROBBLE_QUERY_PORT:-3003}" INDEX_PORT="${VIBESCROBBLE_INDEX_PORT:-3002}" INDEX_URL="${VIBESCROBBLE_INDEX_URL:-http://127.0.0.1:${INDEX_PORT}}" say() { printf '\033[1m%s\033[0m\n' "$*"; } # `--watch` reruns this script whenever the source moves. It never returns. watch_or_continue "$@" say "building" cargo test --quiet -p vibescrobble-query if ! curl -sf "${INDEX_URL}/health" >/dev/null 2>&1; then say "note: no index answering at ${INDEX_URL}" echo " the query service will keep asking; start ./scripts/dev-index.sh" echo fi exec cargo run --quiet -p vibescrobble-query --bin vibescrobble-query -- \ --index "${INDEX_URL}" --listen "127.0.0.1:${PORT}" "$@"