Files
zpan/wrangler.toml
T
saltboandClaude Opus 4.6 3d14f3ceae chore(dev): enhance db:reset for D1 local and add top-level D1 binding
- db:reset script supports --pages flag to reset D1 local database
- Added db:reset:pages npm script
- Added top-level D1 binding in wrangler.toml for local dev
- Standardized dev env var names in .dev.vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 23:52:24 -04:00

56 lines
2.0 KiB
TOML

name = "zpan"
compatibility_date = "2024-12-01"
compatibility_flags = ["nodejs_compat"]
pages_build_output_dir = "./dist"
# Local development D1 binding (used by `wrangler pages dev`)
[[d1_databases]]
binding = "DB"
database_name = "zpan-db-local"
database_id = "local"
migrations_dir = "./migrations"
# ----------------------------------------------------------------------------
# Environment-specific config.
#
# CF Pages has exactly two environments: production and preview. Top-level
# bindings in wrangler.toml apply to BOTH of them unless an [env.<name>] block
# overrides — so to isolate preview from production we must declare both.
#
# Secrets (BETTER_AUTH_SECRET etc.) cannot live in this file. Set them via:
# wrangler pages secret put BETTER_AUTH_SECRET --project-name=zpan
# For preview, the secret is managed directly via the Cloudflare API (there
# is no per-env flag on `wrangler pages secret put` for Pages). See
# scripts/setup-preview.sh (or the project runbook) for the PATCH command.
# ----------------------------------------------------------------------------
# --- production ---
[env.production.vars]
BETTER_AUTH_URL = "https://zpan.pages.dev"
TRUSTED_ORIGINS = "https://zpan.pages.dev"
[[env.production.d1_databases]]
binding = "DB"
database_name = "zpan-db"
database_id = "5bd64957-fa49-4da0-8b7b-6e0ad84037e7"
migrations_dir = "./migrations"
# --- preview ---
# No BETTER_AUTH_URL / TRUSTED_ORIGINS so better-auth falls back to the
# request URL — preview deployments have per-commit subdomains and cannot
# be hardcoded here.
[env.preview.vars]
[[env.preview.d1_databases]]
binding = "DB"
database_name = "zpan-db-preview"
database_id = "a9197d7a-6524-42f0-b646-e714dcb30b3b"
migrations_dir = "./migrations"
# Observability note: Pages Functions do not support [observability] in
# wrangler.toml or via the deployment_configs API. Logs are real-time only:
# npx wrangler pages deployment tail <deployment-id> --project-name=zpan
# For persistent Workers Logs, the project would need to migrate from
# Pages Functions to a standalone Worker.