Eric Rakestraw 0d82e5d60e
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
Add omitempty to JSON fields in alert, forecast, and observation services
2026-03-17 09:03:23 -05:00
2026-03-17 08:35:16 -05:00
2026-03-17 08:35:16 -05:00
2026-03-17 03:32:40 +00:00
2026-03-17 08:35:16 -05:00
2026-03-17 08:35:16 -05:00
2026-03-17 08:35:16 -05:00
2026-03-17 08:35:16 -05:00
2026-03-17 03:32:40 +00:00
2026-03-17 08:35:16 -05:00

weatherapi

weatherapi is a small HTTP API that serves weather data backed by the PostgreSQL schema populated by weatherfeeder.

Config

weatherapi reads a YAML config file that is either:

  • a top-level list of database entries, or
  • an object with databases:.

Example:

- name: weatherdb
  driver: postgres
  params:
    uri: postgres://weatherdb:5432/weatherdb?sslmode=disable
    username: weatherdb
    password: weatherdb

Endpoints

  • GET /observations/current
  • GET /forecast?timestamp=<RFC3339 timestamp>
  • GET /alerts/current

By default, API output is US units for temperature and wind speed:

  • temperature fields: Fahrenheit (*F)
  • wind fields: mph (*Mph)

Run

go run ./cmd/weatherapi -config ./config.yml -addr :8080
Description
A small HTTP API that serves a variety of weather-related endpoints.
Readme AGPL-3.0 7.8 MiB
Languages
Go 99.1%
Dockerfile 0.9%