- Rust 95%
- Docker 5%
rail-trmnl #
A proxy for the National Rail Live Departure Board Web Service (LDBWS). It can be used to query for departures from a station identified by its CRS code.
LDBWS Client #
LDBWS does not provide an official Rust client for their API, but they do provide a Swagger document.
This project uses progenitor to generate a typed API client from the OpenAPI spec derived from the Swagger document.
npx api-spec-converter --from swagger_2 --to openapi_3 --syntax json ldbws-swagger-json.json > ldbws-openapi.json
Configuration #
| Variable | Required | Description |
|---|---|---|
LDBWS_BASE_URL |
Yes | Base URL of the LDBWS API, including the subscription-specific path. |
BIND_ADDR |
No | Address to bind the HTTP server to. Defaults to 0.0.0.0:3000. |
The service does not require an API key at startup.
Authentication #
The service does not store an LDBWS API key. Each client must send its own key, acquired from the Rail Data Marketplace by registering for an account and signing up for a free subscription to the LDBWS (Public Version) API, in the Authorization header of every request.
The proxy forwards the key to LDBWS as the x-apikey header. Both of the following forms are accepted:
curl -H "Authorization: Bearer $LDBWS_API_KEY" \
"http://localhost:3000/dep/PAD"
curl -H "Authorization: $LDBWS_API_KEY" \
"http://localhost:3000/dep/PAD"
Requests without a key receive a 401 Unauthorized response. Since the key is sent with every request, deploy the service behind HTTPS or a trusted reverse proxy.
TRMNL #
The trmnl/ directory holds the markup and settings for the TRMNL private plugin that displays these departures.