Files
vat-api.eu/node_modules/db0/dist/connectors/_internal/cloudflare.mjs
2026-02-13 22:02:30 +01:00

12 lines
357 B
JavaScript

function getCloudflareEnv() {
return globalThis.__env__ || import("cloudflare:workers").then((mod) => mod.env);
}
export async function getHyperdrive(bindingName) {
const env = await getCloudflareEnv();
const binding = env[bindingName];
if (!binding) {
throw new Error(`[db0] [hyperdrive] binding \`${bindingName}\` not found`);
}
return binding;
}