2025-08-08 13:22:54 -04:00
|
|
|
import { domain } from "./stage"
|
2025-05-23 15:57:33 -04:00
|
|
|
|
2025-07-11 05:01:27 +08:00
|
|
|
const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID")
|
|
|
|
|
const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY")
|
2025-09-29 14:17:53 -04:00
|
|
|
export const EMAILOCTOPUS_API_KEY = new sst.Secret("EMAILOCTOPUS_API_KEY")
|
2025-10-20 16:17:49 -04:00
|
|
|
const ADMIN_SECRET = new sst.Secret("ADMIN_SECRET")
|
2026-01-20 23:06:06 -05:00
|
|
|
const DISCORD_SUPPORT_BOT_TOKEN = new sst.Secret("DISCORD_SUPPORT_BOT_TOKEN")
|
|
|
|
|
const DISCORD_SUPPORT_CHANNEL_ID = new sst.Secret("DISCORD_SUPPORT_CHANNEL_ID")
|
|
|
|
|
const FEISHU_APP_ID = new sst.Secret("FEISHU_APP_ID")
|
|
|
|
|
const FEISHU_APP_SECRET = new sst.Secret("FEISHU_APP_SECRET")
|
2025-05-23 14:17:45 -04:00
|
|
|
const bucket = new sst.cloudflare.Bucket("Bucket")
|
|
|
|
|
|
|
|
|
|
export const api = new sst.cloudflare.Worker("Api", {
|
2025-05-23 15:57:33 -04:00
|
|
|
domain: `api.${domain}`,
|
2025-05-23 14:17:45 -04:00
|
|
|
handler: "packages/function/src/api.ts",
|
2025-07-03 09:58:25 -04:00
|
|
|
environment: {
|
|
|
|
|
WEB_DOMAIN: domain,
|
|
|
|
|
},
|
2025-05-23 14:17:45 -04:00
|
|
|
url: true,
|
2026-01-20 23:06:06 -05:00
|
|
|
link: [
|
|
|
|
|
bucket,
|
|
|
|
|
GITHUB_APP_ID,
|
|
|
|
|
GITHUB_APP_PRIVATE_KEY,
|
|
|
|
|
ADMIN_SECRET,
|
|
|
|
|
DISCORD_SUPPORT_BOT_TOKEN,
|
|
|
|
|
DISCORD_SUPPORT_CHANNEL_ID,
|
|
|
|
|
FEISHU_APP_ID,
|
|
|
|
|
FEISHU_APP_SECRET,
|
|
|
|
|
],
|
2025-05-23 14:17:45 -04:00
|
|
|
transform: {
|
|
|
|
|
worker: (args) => {
|
2025-05-30 14:40:53 -04:00
|
|
|
args.logpush = true
|
2025-05-23 14:17:45 -04:00
|
|
|
args.bindings = $resolve(args.bindings).apply((bindings) => [
|
|
|
|
|
...bindings,
|
|
|
|
|
{
|
|
|
|
|
name: "SYNC_SERVER",
|
|
|
|
|
type: "durable_object_namespace",
|
|
|
|
|
className: "SyncServer",
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
args.migrations = {
|
2025-06-19 17:20:13 -04:00
|
|
|
// Note: when releasing the next tag, make sure all stages use tag v2
|
2025-08-21 18:02:32 +08:00
|
|
|
oldTag: $app.stage === "production" || $app.stage === "thdxr" ? "" : "v1",
|
|
|
|
|
newTag: $app.stage === "production" || $app.stage === "thdxr" ? "" : "v1",
|
2025-08-21 17:52:55 +08:00
|
|
|
//newSqliteClasses: ["SyncServer"],
|
2025-05-23 14:17:45 -04:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2025-09-02 23:56:10 -04:00
|
|
|
new sst.cloudflare.x.Astro("Web", {
|
2025-09-02 23:30:26 -04:00
|
|
|
domain: "docs." + domain,
|
2025-06-05 15:37:17 -04:00
|
|
|
path: "packages/web",
|
2025-05-23 14:40:28 -04:00
|
|
|
environment: {
|
2025-07-07 16:31:10 -04:00
|
|
|
// For astro config
|
2025-07-07 16:25:39 -04:00
|
|
|
SST_STAGE: $app.stage,
|
2025-08-08 13:22:54 -04:00
|
|
|
VITE_API_URL: api.url.apply((url) => url!),
|
2025-05-23 14:40:28 -04:00
|
|
|
},
|
|
|
|
|
})
|
2025-12-22 19:38:50 -06:00
|
|
|
|
2025-12-23 15:31:18 -06:00
|
|
|
new sst.cloudflare.StaticSite("WebApp", {
|
2025-12-23 17:03:00 -05:00
|
|
|
domain: "app." + domain,
|
2025-12-22 19:38:50 -06:00
|
|
|
path: "packages/app",
|
|
|
|
|
build: {
|
|
|
|
|
command: "bun turbo build",
|
|
|
|
|
output: "./dist",
|
|
|
|
|
},
|
|
|
|
|
})
|