summaryrefslogtreecommitdiffhomepage
path: root/infra/app.ts
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-08-08 13:22:54 -0400
committerFrank <[email protected]>2025-08-08 13:24:32 -0400
commit183e0911b76025a1f2a82e979d9834fec2131d0e (patch)
tree9987c1753bd64d1ce1d174ab397f1a8c681f642c /infra/app.ts
parentc7bb19ad0712469063eab35589aa5d3602b0c5b1 (diff)
downloadopencode-183e0911b76025a1f2a82e979d9834fec2131d0e.tar.gz
opencode-183e0911b76025a1f2a82e979d9834fec2131d0e.zip
wip: gateway
Diffstat (limited to 'infra/app.ts')
-rw-r--r--infra/app.ts22
1 files changed, 3 insertions, 19 deletions
diff --git a/infra/app.ts b/infra/app.ts
index 2b09516d7..008c1245d 100644
--- a/infra/app.ts
+++ b/infra/app.ts
@@ -1,8 +1,4 @@
-export const domain = (() => {
- if ($app.stage === "production") return "opencode.ai"
- if ($app.stage === "dev") return "dev.opencode.ai"
- return `${$app.stage}.dev.opencode.ai`
-})()
+import { domain } from "./stage"
const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID")
const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY")
@@ -37,24 +33,12 @@ export const api = new sst.cloudflare.Worker("Api", {
},
})
-new sst.cloudflare.x.Astro("Web", {
+export const web = new sst.cloudflare.x.Astro("Web", {
domain,
path: "packages/web",
environment: {
// For astro config
SST_STAGE: $app.stage,
- VITE_API_URL: api.url,
+ VITE_API_URL: api.url.apply((url) => url!),
},
})
-
-const OPENCODE_API_KEY = new sst.Secret("OPENCODE_API_KEY")
-const ANTHROPIC_API_KEY = new sst.Secret("ANTHROPIC_API_KEY")
-const OPENAI_API_KEY = new sst.Secret("OPENAI_API_KEY")
-const ZHIPU_API_KEY = new sst.Secret("ZHIPU_API_KEY")
-
-export const gateway = new sst.cloudflare.Worker("GatewayApi", {
- domain: `api.gateway.${domain}`,
- handler: "packages/function/src/gateway.ts",
- url: true,
- link: [OPENCODE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, ZHIPU_API_KEY],
-})