mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-28 15:51:29 +08:00
53ca110218
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>
27 lines
965 B
TypeScript
27 lines
965 B
TypeScript
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 (~50–100ms 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/*'],
|
||
}
|