Dax Raad 2 месяцев назад
Родитель
Сommit
de4660ac12
5 измененных файлов с 34 добавлено и 2 удалено
  1. 1 0
      bun.lock
  2. 30 0
      infra/enterprise.ts
  3. 1 0
      packages/enterprise/package.json
  4. 1 1
      packages/enterprise/tsconfig.json
  5. 1 1
      sst.config.ts

+ 1 - 0
bun.lock

@@ -177,6 +177,7 @@
         "zod": "catalog:",
       },
       "devDependencies": {
+        "@cloudflare/workers-types": "catalog:",
         "@tailwindcss/vite": "catalog:",
         "@types/luxon": "catalog:",
         "@typescript/native-preview": "catalog:",

+ 30 - 0
infra/enterprise.ts

@@ -0,0 +1,30 @@
+import { domain } from "./stage"
+
+const storage = new sst.cloudflare.Bucket("EnterpriseStorage")
+const token = new cloudflare.ApiToken("EnterpriseStorageToken", {
+  name: `${$app.name}-${$app.stage}-enterprise-storage`,
+  policies: [
+    {
+      effect: "allow",
+      resources: {
+        "com.cloudflare.api.account.*": "*",
+      },
+      permissionGroups: [
+        {
+          id: "c8d07a38f1654800b34e33e59b4e8f41",
+        },
+      ],
+    },
+  ],
+})
+
+const enterprise = new sst.cloudflare.x.SolidStart("Enterprise", {
+  domain: "enterprise." + domain,
+  environment: {
+    OPENCODE_STORAGE_ADAPTER: "r2",
+    OPENCODE_STORAGE_ACCOUNT_ID: sst.cloudflare.DEFAULT_ACCOUNT_ID,
+    OPENCODE_STORAGE_ACCESS_KEY_ID: "---",
+    OPENCODE_STORAGE_SECRET_ACCESS_KEY: "---",
+    OPENCODE_STORAGE_BUCKET: storage.name,
+  },
+})

+ 1 - 0
packages/enterprise/package.json

@@ -24,6 +24,7 @@
     "zod": "catalog:"
   },
   "devDependencies": {
+    "@cloudflare/workers-types": "catalog:",
     "@tailwindcss/vite": "catalog:",
     "@typescript/native-preview": "catalog:",
     "@types/luxon": "catalog:",

+ 1 - 1
packages/enterprise/tsconfig.json

@@ -11,7 +11,7 @@
     "allowJs": true,
     "noEmit": true,
     "strict": true,
-    "types": ["vite/client"],
+    "types": ["@cloudflare/workers-types", "vite/client"],
     "isolatedModules": true,
     "paths": {
       "~/*": ["./src/*"]

+ 1 - 1
sst.config.ts

@@ -9,7 +9,7 @@ export default $config({
       home: "cloudflare",
       providers: {
         stripe: {
-          apiKey: process.env.STRIPE_SECRET_KEY,
+          apiKey: process.env.STRIPE_SECRET_KEY!,
         },
         planetscale: "0.4.1",
       },