diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-15 06:03:23 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-15 06:03:23 +0200 |
| commit | d5c1b7bf0ecb7d0a8d9d440cb8365e404a31bcb8 (patch) | |
| tree | 0648da3cc61cc58c6d91940d113190b3870c74bc /apps/web | |
| parent | 0868d9cf133a5b92ff6cf8dd280d043d48e1cb65 (diff) | |
| download | opencut-d5c1b7bf0ecb7d0a8d9d440cb8365e404a31bcb8.tar.gz | |
fix: load dotenv before env validation in drizzle config
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/drizzle.config.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/web/drizzle.config.ts b/apps/web/drizzle.config.ts index a4b933c6..3a424e3f 100644 --- a/apps/web/drizzle.config.ts +++ b/apps/web/drizzle.config.ts @@ -1,13 +1,17 @@ import type { Config } from "drizzle-kit"; import * as dotenv from "dotenv"; -import { webEnv } from "@/lib/env/web"; -if (webEnv.NODE_ENV === "production") { +if (process.env.NODE_ENV === "production") { dotenv.config({ path: ".env.production" }); } else { dotenv.config({ path: ".env.local" }); } +const databaseUrl = process.env.DATABASE_URL; +if (!databaseUrl) { + throw new Error("DATABASE_URL is not set"); +} + export default { schema: "./src/schema.ts", dialect: "postgresql", @@ -15,8 +19,8 @@ export default { table: "drizzle_migrations", }, dbCredentials: { - url: webEnv.DATABASE_URL, + url: databaseUrl, }, out: "./migrations", - strict: webEnv.NODE_ENV === "production", + strict: process.env.NODE_ENV === "production", } satisfies Config; |
