mirror of
https://github.com/sst/opencode.git
synced 2025-07-07 16:14:59 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
export const domain = (() => {
|
|
if ($app.stage === "production") return "opencode.ai"
|
|
if ($app.stage === "dev") return "dev.opencode.ai"
|
|
return `${$app.stage}.dev.opencode.ai`
|
|
})()
|
|
|
|
const bucket = new sst.cloudflare.Bucket("Bucket")
|
|
|
|
export const api = new sst.cloudflare.Worker("Api", {
|
|
domain: `api.${domain}`,
|
|
handler: "packages/function/src/api.ts",
|
|
environment: {
|
|
WEB_DOMAIN: domain,
|
|
},
|
|
url: true,
|
|
link: [bucket],
|
|
transform: {
|
|
worker: (args) => {
|
|
args.logpush = true
|
|
args.bindings = $resolve(args.bindings).apply((bindings) => [
|
|
...bindings,
|
|
{
|
|
name: "SYNC_SERVER",
|
|
type: "durable_object_namespace",
|
|
className: "SyncServer",
|
|
},
|
|
])
|
|
args.migrations = {
|
|
// Note: when releasing the next tag, make sure all stages use tag v2
|
|
oldTag: $app.stage === "production" ? "" : "v1",
|
|
newTag: $app.stage === "production" ? "" : "v1",
|
|
//newSqliteClasses: ["SyncServer"],
|
|
}
|
|
},
|
|
},
|
|
})
|
|
|
|
new sst.cloudflare.x.Astro("Web", {
|
|
domain,
|
|
path: "packages/web",
|
|
environment: {
|
|
VITE_API_URL: api.url,
|
|
},
|
|
})
|