Add the Home Assistant REST calendar client and the idempotent sync that writes important school events to Sam's Home Assistant calendar (FR-8). The school stays read-only; the only write is to the calendar (rule 7). - internal/calendar: HA REST client (states, create_event, get_events, delete_event) and the sync that selects important future events, adopts an existing event by its description marker, records the HA event id on the item, and records every attempt. - internal/store: migration 003 (items.ha_event_uid, items.ha_pushed_at and the append-only calendar_pushes table), candidates, mark-synced and the push log. - internal/parse: a school event is important; a routine class period is not. - cmd/school: `school calendar entities|status|push|events`. - web: an "Add to calendar" item action and a fail-loud calendar banner, so a failed write is never swallowed (FR-12). - scripts/calendar-push.sh, Makefile target, env example, docs and tests. The target is configurable (SCHOOL_HA_CALENDAR_ENTITY). Home Assistant has no non-Google writable calendar today, so the entity is asked on AUD-110. Co-Authored-By: Paperclip <noreply@paperclip.ing>
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
# Compass / NHS — service environment (EXAMPLE).
|
|
#
|
|
# Copy to environment.d/school-service.env and fill the secrets in. The real
|
|
# file is gitignored; never commit it. Generate values with:
|
|
# docker run --rm --entrypoint /app/school compass-teams-nhs/school:0.1.0-phase1 gen-secret
|
|
# docker run --rm --entrypoint /app/school compass-teams-nhs/school:0.1.0-phase1 hash-password 'the-password'
|
|
|
|
# Listen address inside the container. The host maps 8792 -> 8792.
|
|
SCHOOL_ADDR=:8792
|
|
|
|
# SQLite database in the named volume.
|
|
SCHOOL_DB_PATH=/data/school.db
|
|
|
|
# Signs the session cookie. Required, >= 16 characters. Secret.
|
|
SCHOOL_SESSION_SECRET=change-me-32-bytes-of-random
|
|
|
|
# The single dashboard login (Sam). Prefer the bcrypt hash over the plaintext.
|
|
SCHOOL_ADMIN_USERNAME=sam
|
|
SCHOOL_ADMIN_PASSWORD_HASH=
|
|
SCHOOL_ADMIN_PASSWORD=
|
|
|
|
# Keep true behind HTTPS (Caddy terminates TLS).
|
|
SCHOOL_COOKIE_SECURE=true
|
|
SCHOOL_SESSION_TTL=12h
|
|
|
|
# Family timezone for due dates and briefs.
|
|
SCHOOL_TIMEZONE=Australia/Sydney
|
|
|
|
SCHOOL_LOG_LEVEL=info
|
|
SCHOOL_APP_ENV=production
|
|
|
|
# ---- Home Assistant calendar (AGENTS.md §4 FR-8, Phase 6) -------------------
|
|
# Important school events are written to Sam's Home Assistant calendar through
|
|
# the Home Assistant REST API. Nothing is written until all three of URL, token
|
|
# and entity are set; the dashboard shows CALENDAR NOT CONFIGURED until then.
|
|
#
|
|
# The token is a long-lived access token created on Sam's Home Assistant
|
|
# profile page. It is a SECRET: keep it in this file only.
|
|
SCHOOL_HA_URL=http://192.168.20.30:8123
|
|
SCHOOL_HA_TOKEN=
|
|
# The calendar entity to write to. Discover the real ids with:
|
|
# scripts/calendar-push.sh entities
|
|
SCHOOL_HA_CALENDAR_ENTITY=calendar.school
|
|
# The internal .lab Caddy certificate is not in the container trust store.
|
|
# Set true only when SCHOOL_HA_URL is the https://homeassistant.home.lab URL.
|
|
SCHOOL_HA_INSECURE=false
|
|
SCHOOL_HA_TIMEOUT=20s
|