mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 02:04:22 +01:00
16 lines
403 B
TypeScript
16 lines
403 B
TypeScript
import { env } from "cloudflare:workers"
|
|
|
|
export const Resource = new Proxy(
|
|
{},
|
|
{
|
|
get(_target, prop: string) {
|
|
if (prop in env) {
|
|
// @ts-expect-error
|
|
const value = env[prop]
|
|
return typeof value === "string" ? JSON.parse(value) : value
|
|
}
|
|
throw new Error(`"${prop}" is not linked in your sst.config.ts (cloudflare)`)
|
|
},
|
|
},
|
|
) as Record<string, any>
|