app.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { domain } from "./stage"
  2. const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID")
  3. const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY")
  4. export const EMAILOCTOPUS_API_KEY = new sst.Secret("EMAILOCTOPUS_API_KEY")
  5. const bucket = new sst.cloudflare.Bucket("Bucket")
  6. export const api = new sst.cloudflare.Worker("Api", {
  7. domain: `api.${domain}`,
  8. handler: "packages/function/src/api.ts",
  9. environment: {
  10. WEB_DOMAIN: domain,
  11. },
  12. url: true,
  13. link: [bucket, GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY],
  14. transform: {
  15. worker: (args) => {
  16. args.logpush = true
  17. args.bindings = $resolve(args.bindings).apply((bindings) => [
  18. ...bindings,
  19. {
  20. name: "SYNC_SERVER",
  21. type: "durable_object_namespace",
  22. className: "SyncServer",
  23. },
  24. ])
  25. args.migrations = {
  26. // Note: when releasing the next tag, make sure all stages use tag v2
  27. oldTag: $app.stage === "production" || $app.stage === "thdxr" ? "" : "v1",
  28. newTag: $app.stage === "production" || $app.stage === "thdxr" ? "" : "v1",
  29. //newSqliteClasses: ["SyncServer"],
  30. }
  31. },
  32. },
  33. })
  34. new sst.cloudflare.x.Astro("Web", {
  35. domain: "docs." + domain,
  36. path: "packages/web",
  37. environment: {
  38. // For astro config
  39. SST_STAGE: $app.stage,
  40. VITE_API_URL: api.url.apply((url) => url!),
  41. },
  42. })