- Base URL corrected to https://www.fuel-finder.service.gov.uk (the api.fuelfinder.service.gov.uk host in the portal's examples is stale — it does not resolve; www.fuel-finder... resolves to CloudFront and is what the live spec uses). Verified: /health now reports source=api, 8,010 stations, 0 failures. - Fuel Finder is strictly sequential (30 rpm per client, 429 on overlap): added FUEL_API_BATCH_SLEEP (default 4.0s) between pages ≈ 15 rpm. - Stale-cache refresh moved off the request path into a background thread — a multi-minute rate-limited sync no longer blows the app's 5s timeout; stale data is served while it catches up. - Multiple diesel variants (B7_STANDARD, B7_PREMIUM, B10) now map to DIESEL as the MINIMUM price, so a premium price can't inflate the cheapest-diesel reference (CSV relay took first-wins; min is safer). - Added B7_PREMIUM (underscore) to the fuel map — official key. - scripts/run.sh now prefers the project venv (bare python3 missed uvicorn when run outside an activated env). - Tests updated for min-diesel + B7_PREMIUM; 12/12 pass.
21 lines
566 B
Bash
Executable File
21 lines
566 B
Bash
Executable File
#!/bin/bash
|
|
# FuelBoard Relay API launcher (official Fuel Finder API source)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if [ ! -f .env ]; then
|
|
echo "⚠ No .env found — running in DEMO/CSV-fallback mode (no credentials)."
|
|
fi
|
|
|
|
set -a
|
|
[ -f .env ] && source .env
|
|
set +a
|
|
|
|
PORT="${FUEL_RELAY_PORT:-8789}"
|
|
|
|
# Prefer the project venv so the bare `python3` fallback can't miss uvicorn.
|
|
if [ -x ".venv/bin/python" ]; then
|
|
exec .venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port "$PORT"
|
|
fi
|
|
exec python3 -m uvicorn app.main:app --host 0.0.0.0 --port "$PORT"
|