diff options
| author | Frank <[email protected]> | 2025-08-29 19:34:56 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-08-29 19:34:58 -0400 |
| commit | c3a25eff78635725472096fe2626021ee50f36b0 (patch) | |
| tree | adecb00a9340d2baea27b3f30f254054810d9490 /cloud/core/src | |
| parent | b40c02e2583c6e35f97849e98f66609e67dac322 (diff) | |
| download | opencode-c3a25eff78635725472096fe2626021ee50f36b0.tar.gz opencode-c3a25eff78635725472096fe2626021ee50f36b0.zip | |
wip: cloud
Diffstat (limited to 'cloud/core/src')
| -rw-r--r-- | cloud/core/src/billing.ts | 2 | ||||
| -rw-r--r-- | cloud/core/src/drizzle/index.ts | 2 | ||||
| -rw-r--r-- | cloud/core/src/util/resource.ts | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/cloud/core/src/billing.ts b/cloud/core/src/billing.ts index 94ba23b83..705999c26 100644 --- a/cloud/core/src/billing.ts +++ b/cloud/core/src/billing.ts @@ -1,4 +1,3 @@ -import { Resource } from "sst" import { Stripe } from "stripe" import { Database, eq, sql } from "./drizzle" import { BillingTable, PaymentTable, UsageTable } from "./schema/billing.sql" @@ -8,6 +7,7 @@ import { z } from "zod" import { Identifier } from "./identifier" import { centsToMicroCents } from "./util/price" import { User } from "./user" +import { Resource } from "./util/resource" export namespace Billing { export const stripe = () => diff --git a/cloud/core/src/drizzle/index.ts b/cloud/core/src/drizzle/index.ts index f35ce0a34..894f578f8 100644 --- a/cloud/core/src/drizzle/index.ts +++ b/cloud/core/src/drizzle/index.ts @@ -1,5 +1,5 @@ import { drizzle } from "drizzle-orm/postgres-js" -import { Resource } from "sst" +import { Resource } from "../util/resource" export * from "drizzle-orm" import postgres from "postgres" diff --git a/cloud/core/src/util/resource.ts b/cloud/core/src/util/resource.ts new file mode 100644 index 000000000..1543145dc --- /dev/null +++ b/cloud/core/src/util/resource.ts @@ -0,0 +1,14 @@ +import { env } from "cloudflare:workers"; + +export const Resource = new Proxy( + {}, + { + get(_target, prop: string) { + if (prop in env) { + const value = env[prop]; + return typeof value === "string" ? JSON.parse(value) : value; + } + throw new Error(`"${prop}" is not linked in your sst.config.ts`); + }, + } +) as Record<string, any>; |
