Replace astro:content getCollection() reads in all 9 content pages with src/lib/content-source.ts: Appwrite TablesDB (spaghet-home database on appwrite.spaghet.io) first, bundled src/content/*.md fallback on a cold-cache outage. Blog/project/legal detail pages flip from prerender to SSR (content now arrives at request time); sitemap keeps every detail URL via customPages computed from the bundled .md copies. - src/lib/appwrite.ts: TablesDB service (node-appwrite), markdown rendered through Astro's own satteri+shiki pipeline (dual-theme, same config as astro.config.mjs) — article HTML verified byte-identical to production. Public reads: tables grant read(any), no secret required. 60s in-process cache, stale-serving on refresh failure. - src/lib/__tests__/appwrite.test.ts: 11 tests mocking the SDK boundary (the SDK binds its own fetch, so global stubs do not intercept it). - Draft posts now 302 to /blog and drop off listings/RSS/search at request time instead of at build time. - astro check: 0 errors; vitest: 94 pass; build clean; end-to-end verified against live Appwrite and against a forced outage.
24 lines
995 B
Bash
24 lines
995 B
Bash
# Copy to .env (gitignored; dotenv-cli loads it for dev/start/build).
|
|
#
|
|
# Content reads are PUBLIC — every Appwrite table grants read("any") — so the
|
|
# site works with none of these set. Defaults point at the homelab instance.
|
|
|
|
# Appwrite TablesDB content backend (src/lib/appwrite.ts)
|
|
# APPWRITE_ENDPOINT=https://appwrite.spaghet.io/v1
|
|
# APPWRITE_PROJECT_ID=homelab
|
|
# APPWRITE_DATABASE_ID=spaghet-home
|
|
|
|
# Optional: a server key sent with every read (bypasses the guest rate
|
|
# limiter). Needs only databases.read/collections.read/documents.read-style
|
|
# read scopes — see the spaghet-home-content key. Never exposed to the browser.
|
|
# APPWRITE_API_KEY=
|
|
|
|
*** In-process cache lifetime for content reads, seconds. On a failed refresh
|
|
# the stale value is served; a cold-cache failure falls back to the bundled
|
|
# .md copies under src/content.
|
|
# APPWRITE_CONTENT_TTL_SECONDS=60
|
|
|
|
# Uptime Kuma status page (src/lib/status.ts)
|
|
# STATUS_PAGE_URL=https://uptime.spaghet.io
|
|
# STATUS_PAGE_SLUG=public
|