FuelBoard Relay API: official Fuel Finder API adapter (sibling of CSV relay)
- Talks to the OFFICIAL GOV.UK Fuel Finder API instead of the public CSV mirror: OAuth token (/api/v1/oauth/generate_access_token), batched paging (500/page via batch-number) over /api/v1/pfs and /api/v1/pfs/fuel-prices, joined on node_id. - Price strings parsed to pence with pounds->pence correction (< 2.0); 50-500p sane band keeps junk out of the cheapest reference. - Fuel mapping: E5/E10 as-is; B7/B7_STANDARD/B7S/B7P/B10 -> DIESEL; HVO/SDV dropped (app tracks E5/E10/DIESEL only). - lat/lng parsed from nested location strings. - Output contract IDENTICAL to fuelboard-relay (/health + /api/v1/stations), so the app/widget/alerts work unchanged; switch = point app at :8789. - CSV mirror kept as automatic fallback (FUEL_SOURCE=auto) so the full path is testable before GOV.UK One Login creds exist. - 12 unit tests against documented API shapes (no network).
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Copy to .env and fill in — NEVER commit .env
|
||||
FUEL_API_CLIENT_ID=
|
||||
FUEL_API_CLIENT_SECRET=
|
||||
FUEL_API_TOKEN_URL=https://api.fuelfinder.service.gov.uk/api/v1/oauth/generate_access_token
|
||||
FUEL_API_PFS_URL=https://api.fuelfinder.service.gov.uk/api/v1/pfs
|
||||
FUEL_API_PRICES_URL=https://api.fuelfinder.service.gov.uk/api/v1/pfs/fuel-prices
|
||||
FUEL_CACHE_TTL=300
|
||||
FUEL_RELAY_PORT=8789
|
||||
# FUEL_SOURCE=auto # auto (API if creds, CSV fallback) | csv | api
|
||||
Reference in New Issue
Block a user