cloudaxe-opencode/infra/app.ts

46 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-05-23 19:57:33 +00:00
export const domain = (() => {
if ($app.stage === "production") return "opencode.ai"
if ($app.stage === "dev") return "dev.opencode.ai"
return `${$app.stage}.dev.opencode.ai`
})()
2025-05-23 18:17:45 +00:00
const bucket = new sst.cloudflare.Bucket("Bucket")
export const api = new sst.cloudflare.Worker("Api", {
2025-05-23 19:57:33 +00:00
domain: `api.${domain}`,
2025-05-23 18:17:45 +00:00
handler: "packages/function/src/api.ts",
2025-07-03 13:58:25 +00:00
environment: {
WEB_DOMAIN: domain,
},
2025-05-23 18:17:45 +00:00
url: true,
link: [bucket],
transform: {
worker: (args) => {
2025-05-30 18:40:53 +00:00
args.logpush = true
2025-05-23 18:17:45 +00:00
args.bindings = $resolve(args.bindings).apply((bindings) => [
...bindings,
{
name: "SYNC_SERVER",
type: "durable_object_namespace",
className: "SyncServer",
},
])
args.migrations = {
2025-06-19 21:20:13 +00:00
// 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"],
2025-05-23 18:17:45 +00:00
}
},
},
})
2025-06-08 03:46:53 +00:00
new sst.cloudflare.x.Astro("Web", {
2025-05-23 19:57:33 +00:00
domain,
2025-06-05 19:37:17 +00:00
path: "packages/web",
2025-05-23 18:40:28 +00:00
environment: {
2025-07-07 20:25:39 +00:00
SST_STAGE: $app.stage,
2025-05-23 18:40:28 +00:00
VITE_API_URL: api.url,
},
})