sst.config.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 lake = stage.deployAws ? await import("./infra/lake.js") : undefined
  33. const stats = stage.deployAws ? await import("./infra/stats.js") : undefined
  34. const { stat } = await import("./infra/console.js")
  35. await import("./infra/enterprise.js")
  36. if ($app.stage === "production" || $app.stage === "vimtor") {
  37. await import("./infra/monitoring.js")
  38. }
  39. return {
  40. StatWorkerUrl: stat.url,
  41. ...(stats ? { StatsUrl: stats.app.url } : {}),
  42. ...(lake
  43. ? {
  44. LakeUrl: lake.lakeIngest.properties.url,
  45. LakeSecretSsm: lake.ingestSecretSsm.name,
  46. }
  47. : {}),
  48. AwsStage: stage.awsStage,
  49. }
  50. },
  51. })