sst.config.ts 1.6 KB

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