teqo-backup/.env.example
Francisco Ignácio Fontoura Solla f96863fad1 Add secured on-demand revalidation endpoint for posts cache
Public post pages read through the `posts`-tagged unstable_cache wrappers,
so their data is frozen at build time until revalidateTag('posts') runs in
the deployed runtime. A direct-DB seed (pnpm db:seed:posts) writes past the
Payload afterChange hooks (next/cache is stubbed), so nothing busts the tag
in prod and seeded posts never surface publicly.

Add POST /api/revalidate, guarded by a REVALIDATE_SECRET shared secret
(constant-time compare), that calls revalidatePostsListing() to refresh the
home page, all listings, and all article routes at once. Document the env var
in .env.example; it must be set in Vercel for production.
2026-07-15 21:24:02 -03:00

20 lines
1 KiB
Text

# Copy this file to `.env.local` for local development.
#
# For LOCAL DEVELOPMENT, DATABASE_URL must point at the local Postgres started by
# docker-compose (`pnpm db:start`). `pnpm dev` will REFUSE to start against a
# non-local host (e.g. the production Neon database) unless you explicitly set
# ALLOW_REMOTE_DB=true — this is intentional, to protect production data.
DATABASE_URL=postgresql://teqo:teqo@localhost:5432/teqo
PAYLOAD_SECRET=YOUR_SECRET_HERE
BLOB_READ_WRITE_TOKEN=YOUR_BLOB_TOKEN_HERE
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Shared secret guarding POST /api/revalidate, which busts the `posts` cache tag
# on demand. Needed after a direct-DB seed (`pnpm db:seed:posts`) since that
# bypasses the Payload hooks that normally call revalidateTag. MUST be set in the
# Vercel project env for production. Generate with e.g. `openssl rand -hex 32`.
REVALIDATE_SECRET=YOUR_REVALIDATE_SECRET_HERE
# Note: the automated test suite ignores this file and reads .env.test instead,
# and only ever runs against a database whose name ends with "_test".