sst.config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /// <reference path="./.sst/platform/config.d.ts" />
  2. export default $config({
  3. app(input) {
  4. return {
  5. name: "opencode",
  6. removal: input?.stage === "production" ? "retain" : "remove",
  7. protect: ["production"].includes(input?.stage),
  8. home: "cloudflare",
  9. providers: {
  10. aws: {
  11. version: "7.30.0",
  12. region: "us-east-1",
  13. profile: process.env.GITHUB_ACTIONS
  14. ? undefined
  15. : input.stage === "production"
  16. ? "opencode-production"
  17. : "opencode-dev",
  18. },
  19. stripe: {
  20. version: "0.0.28",
  21. apiKey: process.env.STRIPE_SECRET_KEY!,
  22. },
  23. random: "4.19.2",
  24. planetscale: "0.4.1",
  25. honeycomb: "0.49.0",
  26. },
  27. }
  28. },
  29. async run() {
  30. const stage = await import("./infra/stage.js")
  31. await import("./infra/app.js")
  32. const stats = stage.deployAws ? await import("./infra/lake.js").then(() => import("./infra/stats.js")) : undefined
  33. const { stat } = await import("./infra/console.js")
  34. await import("./infra/enterprise.js")
  35. if ($app.stage === "production" || $app.stage === "vimtor") {
  36. await import("./infra/monitoring.js")
  37. }
  38. return {
  39. StatWorkerUrl: stat.url,
  40. ...(stats ? { StatsUrl: stats.app.url } : {}),
  41. AwsStage: stage.awsStage,
  42. }
  43. },
  44. })