Skip to content

Latest commit

 

History

History
91 lines (55 loc) · 3.59 KB

File metadata and controls

91 lines (55 loc) · 3.59 KB

🗑📅 Cheshire East Bin Collection iCalendar (.ics)

GitHub tag license

Fetches Cheshire East bin collection schedule for a Unique Property Reference Number (UPRN) and serves an auto-updating .ics calendar at a public URL.

Disclaimer: This project is pulling data directly from Cheshire East from a non-public API, and may be unstable, or even disappear without notice.

To prevent abuse, there are a few built-in mechanisms to prevent needlessly hammering the upstream data source by default (do bin collections update that frequently?!)

TOC


Prerequisites

Cheshire East UPRN Lookup

You can find your Unique Property Reference Number (UPRN) in Cheshire East by following these steps:

  1. Use the Address Finder on the Cheshire East Public Map Viewer

Cheshire East Public Map Viewer - Address Finder

  1. Search for your address, and note your UPRN

Cheshire East Unique Property Reference Number UPRN

Installation

Running with Docker

docker run -d -e UPRN="100012357047" -p 8080:8080 bbrks/cheshire-east-bin-collection-ics

Running standalone

  1. Download the latest release binary

  2. Run the service with your UPRN:

    ./cheshire-east-bin-collection-ics -uprn="100012357047"
    
  3. Your public calendar URL will be logged on startup:

     2019-05-28T23:32:32.614+01:00 [ALL] Serving calendar at http://[::]:8080/collections.ics
     2019-05-28T23:32:34.334+01:00 [INF] req:1 <-- GET /collections.ics from [::1]:58626
     2019-05-28T23:32:34.334+01:00 [INF] req:1 Fetching a fresh copy of data
     2019-05-28T23:32:39.325+01:00 [INF] req:1 --> 200 (OK) in 4.991430799s
     2019-05-28T23:32:42.235+01:00 [INF] req:2 <-- GET /collections.ics from [::1]:58660
     2019-05-28T23:32:42.235+01:00 [DBG] req:2 Skipping update and serving data from cache
     2019-05-28T23:32:42.237+01:00 [INF] req:2 --> 200 (OK) in 1.65305ms
    

Configuration Options

  • -uprn="100012357047"
    • Set the UPRN to fetch the collection schedule for
    • This is intentionally not parameterised in the public URL, to prevent accidentally hosting a public service 🙃
  • -updateInterval=24h
    • Set how often the service looks for new data
    • Range: 24h to 7d
  • -addr="0.0.0.0:1234"
    • Change the listen address/port

Building from source

Dockerfile

There's a multi-stage dockerfile in the repo which will compile and produce a lightweight runnable image:

docker build -t cheshire-east-bin-collection-ics:latest .

Binaries

With Go already installed, you can build a binary with the following command:

go build .

Contributing

Issues, feature requests or improvements welcome!

Licence

This project is licensed under the MIT License.