railyard/apps/console/wrangler.jsonc
caelum0x 775b4dae1c fix(console): point SCRIBASE_URL at a real provisioned project, fix a SQL-execute client guard
Console has been deployed since 2026-10-14 but sign-in never worked: SCRIBASE_URL
was baked to the Scribase control-plane API (api.scribase.com) instead of a real
project's own gateway, because no project had ever been provisioned for it.

Also fixed a real, unrelated bug found while provisioning: the control-api's
real-time project-runtime image (scribase-project-runtime:local) had been
reclaimed by a routine docker image prune (it has no running container, so it's
unprotected) -- this broke every new Scribase project, temp or paid, not just
this one. Rebuilt it on box 1 via the documented narrow compose step.

Provisioned a real (temporary, 72h TTL) Scribase project for the console via
`npx scribase init --temp --yes` against production, applied all 14 of
db/migrations/*.sql against it via the real database/execute API (0007_ship.sql
had a literal backslash in a regex that the SQL-execute endpoint's injection
guard rejects outside E'...'/$$...$$ -- rewrote `github\.com` as the
behaviorally-identical `github[.]com` character class; existing tests already
only check accept/reject behavior, unaffected), and wired the real anon/service
role keys via `wrangler secret put`.

Deployed (version 49f09f0f-d84b-4379-acc4-d1a78df81a90) and verified end to end:
a real POST to /auth/email now reaches the real gateway's /auth/v1/otp (confirmed
by direct curl to the gateway, bypassing the app) and correctly hits GoTrue's own
over_email_send_rate_limit after repeated test calls -- proof the full
app -> SCRIBASE_URL -> gateway -> GoTrue chain is for real wired correctly, not
the prior 404 "route not found" / zero-project-exists failure.

Remaining real step (not done here): this project is temporary and expires in
72h. A permanent one needs either a real SCRIBASE_ACCESS_TOKEN for the
ereboslab org, or the $1 Dodo card-check "Keep this project" flow at the
project's claim URL -- both genuinely owner-gated (2FA / a real card), see
plans/railyard.md and apps/console/DEPLOY.md for the exact next step.
2026-10-27 18:33:13 +03:00

37 lines
2.0 KiB
JSON

{
// Railyard console on Cloudflare Workers (OpenNext adapter), our account.
// Nothing secret lives here. Secrets are set with `wrangler secret put`
// by the owner: DODO_API_KEY, DODO_WEBHOOK_SECRET, SCRIBASE_ANON_KEY,
// SCRIBASE_SERVICE_ROLE_KEY, RAILYARD_SESSION_SECRET, RAILYARD_SCRIBASE_BRIDGE_SECRET,
// INSIGHTS_API_TOKEN, RELAY_TENANT_KEY, RAILYARD_CREDENTIALS_KEY.
"$schema": "node_modules/wrangler/config-schema.json",
"name": "railyard-console",
"main": ".open-next/worker.js",
"compatibility_date": "2026-09-20",
"compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
"workers_dev": false,
"preview_urls": false,
"assets": { "binding": "ASSETS", "directory": ".open-next/assets" },
"observability": { "enabled": true, "head_sampling_rate": 1 },
// Until the Railyard domain and Dodo brand exist (owner items 11 and 18).
"routes": [{ "pattern": "railyard.ereboslab.com", "custom_domain": true }],
// The collector's site entries (RYP-E1, PY1.3): the same namespace the edge
// collector reads: namespace RAILYARD_SITES, created 2026-09-30.
"kv_namespaces": [{ "binding": "SITES", "id": "323121abfdc64ff6ab90927620d3dbb2" }],
"vars": {
"RAILYARD_CONSOLE_URL": "https://railyard.ereboslab.com",
// Must be this project's own gateway host, never the control-plane API
// (api.scribase.com) — see lib/config.ts's readConfig guard, added after
// 2026-10-14's misconfiguration shipped a console that rendered but could
// never sign anyone in. Real project provisioned 2026-10-27 (temporary,
// 72h TTL — see DEPLOY.md for the permanent-project follow-up).
"SCRIBASE_URL": "https://tmp-2166d461a77eddee12cbf35f-railyard-console-prov-3c10ee6e.scribase.com",
// Insights tenant API (the box's tunnel route to the fork's /api/v1); token is a secret.
"INSIGHTS_API_URL": "",
// Relay's OpenAI-compatible base for the BYOK AI gateway (PY1.4); the tenant key is a secret.
"RELAY_URL": "",
"RAILYARD_INSIGHTS_URL": "https://insights.railyard.ereboslab.com",
"DODO_API_BASE": "https://test.dodopayments.com"
}
}