name = "inkwell" main = "worker/index.ts" compatibility_date = "2024-09-23" compatibility_flags = ["nodejs_compat"] # Bind the Worker to inkwell.tlmtech.dev. # `custom_domain = true` tells Cloudflare to manage the DNS record and TLS # cert automatically in the tlmtech.dev zone — no manual DNS work needed. [[routes]] pattern = "inkwell.tlmtech.dev" custom_domain = true # Serve the built React SPA from ./dist. # `not_found_handling = "single-page-application"` makes /s/:id and /share/:token # fall back to index.html for client-side routing. [assets] directory = "./dist" binding = "ASSETS" not_found_handling = "single-page-application" # R2 bucket holding scene JSON blobs and SVG thumbnails. # Create with: wrangler r2 bucket create inkwell [[r2_buckets]] binding = "R2" bucket_name = "inkwell" preview_bucket_name = "inkwell" # D1 database holding the metadata index (scenes, share_tokens). # Create with: wrangler d1 create inkwell # Then put the returned database_id in here. [[d1_databases]] binding = "DB" database_name = "inkwell" database_id = "0f23be25-c480-42a6-981f-2cc13c2d7758" # Drizzle generates SQL into ./drizzle; wrangler tracks applied files in # the d1_migrations table inside D1. migrations_dir = "drizzle" # Non-secret config. Override per-env in [env.production.vars]. [vars] # Comma-separated list of allowed origins for CORS (leave empty = same-origin only). # The SPA and API are served from the same Worker on inkwell.tlmtech.dev, # so same-origin (empty) is correct unless we add a separate frontend host. ALLOWED_ORIGINS = "" # Secrets to set via: # wrangler secret put SUPER_ADMIN_EMAIL # wrangler secret put SUPER_ADMIN_PASSWORD # wrangler secret put SESSION_SECRET # # SUPER_ADMIN_EMAIL : email used to bootstrap the first admin account. # On first login matching this email, if no row exists # in the `users` table, a super-admin is created with # SUPER_ADMIN_PASSWORD as the initial password. After # bootstrap, the admin manages their password from the # UI; the env vars remain as break-glass and are only # consulted again if no row exists for that email. # SUPER_ADMIN_PASSWORD : initial password for the bootstrap super-admin. # SESSION_SECRET : random 32+ byte string used to HMAC session cookies. # Daily at 04:00 UTC: purge Trash entries older than 30 days # (`scheduled` handler in worker/index.ts → services/trash.ts#purgeExpired). # Test locally with `wrangler dev --test-scheduled` and # curl "http://localhost:8888/__scheduled?cron=0+4+*+*+*" [triggers] crons = ["0 4 * * *"]