fix: prisma.config.ts use dotenv to load .env (Prisma env() broken)

This commit is contained in:
2026-03-24 07:16:11 +03:00
parent cac8f5434d
commit 4b6284b04d
3 changed files with 23 additions and 6 deletions

19
package-lock.json generated
View File

@@ -19,6 +19,7 @@
"@types/react-dom": "^19.2.3",
"bcryptjs": "^3.0.3",
"better-auth": "^1.5.5",
"dotenv": "^17.3.1",
"ioredis": "^5.10.1",
"livekit-client": "^2.17.3",
"livekit-server-sdk": "^2.15.0",
@@ -3355,6 +3356,18 @@
}
}
},
"node_modules/c12/node_modules/dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/call-bind": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
@@ -3787,9 +3800,9 @@
}
},
"node_modules/dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz",
"integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"

View File

@@ -26,6 +26,7 @@
"@types/react-dom": "^19.2.3",
"bcryptjs": "^3.0.3",
"better-auth": "^1.5.5",
"dotenv": "^17.3.1",
"ioredis": "^5.10.1",
"livekit-client": "^2.17.3",
"livekit-server-sdk": "^2.15.0",

View File

@@ -1,15 +1,18 @@
import path from "node:path";
import { defineConfig, env } from "prisma/config";
import { defineConfig } from "prisma/config";
import dotenv from "dotenv";
dotenv.config({ path: path.join(__dirname, ".env") });
export default defineConfig({
earlyAccess: true,
schema: path.join(__dirname, "prisma", "schema.prisma"),
datasource: {
url: env("DATABASE_URL"),
url: process.env.DATABASE_URL!,
},
migrate: {
async url() {
return env("DATABASE_URL")!;
return process.env.DATABASE_URL!;
},
},
} as any);