Files
zpan/server/entry-netlify.ts
T
saltbo 53ca110218 feat(about): split runtime into runtime engine + deployment platform
Flatten the instance `runtime` object into two fields: `runtime` (the JS engine,
node | workerd) and `platform` (the deployment host). The About page shows each
as its own row with friendly labels (e.g. "workerd" + "Cloudflare Workers",
"Node.js" + "Docker").

- Detect the platform from the entry file (entry === target): each serverless
  entry declares it; entry-node sniffs Cloud Run (K_SERVICE) / Docker
  (ZPAN_RUNTIME, set in the Dockerfile) / bare node. Cloudflare is detected from
  the D1 binding.
- Decouple the cloud payload: zpan-cloud-sdk fixes runtime { provider, target },
  so CloudInstanceInfo keeps that shape and buildCloudInstanceInfo maps to it;
  buildInstanceInfo serves the richer flat shape to the About API.
- Migrate PostHog instance telemetry to the runtime/platform shape and merge the
  duplicate runtimeInfo in licensing-admin into the shared one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 14:56:29 -04:00

27 lines
965 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { handle } from 'hono/netlify'
import { createBootstrap } from './bootstrap'
import { createLibsqlPlatform } from './platform/libsql'
import { setDeployPlatform } from './runtime-platform'
setDeployPlatform('netlify')
// Migrations are applied by the deploy workflow (drizzle-kit migrate) before
// function deployment. createLibsqlPlatform also runs migrate() at cold start —
// it's idempotent (~50100ms round-trip against __drizzle_migrations) and serves
// as a safety net if a deployment ever skips the workflow migration step.
const platform = await createLibsqlPlatform({
TURSO_DATABASE_URL: process.env.TURSO_DATABASE_URL!,
TURSO_AUTH_TOKEN: process.env.TURSO_AUTH_TOKEN,
})
const app = await createBootstrap(platform)
export default handle(app)
// Route all API and redirect paths to this function.
// The SPA fallback (/* → /index.html) in netlify.toml covers everything else.
export const config = {
path: ['/api/*', '/r/*'],
}