Init Drizzle with cloudflare env variables

I'm trying to connect my database with the drizzle adapter. My backend will be hosted on cloudflare workers (with hono) so I can't use process.env to get my environement variables. How to get my cloudflare env variables to the db init ?

Thanks for your help!


import { drizzle } from "drizzle-orm/neon-http"; import { neon } from "@neondatabase/serverless"; interface Env { Bindings: { DATABASE_URL: string }; } const sql = neon("DATABASE_URL"); export const db = drizzle(sql);
Solution
import { drizzle } from "drizzle-orm/d1";
import * as schema from "./auth-schema";

export const createDrizzle = (db: D1Database) => drizzle(db, { schema });
Was this page helpful?