Просмотр исходного кода

chore(@growi/app): update prisma config

mizozobu 1 месяц назад
Родитель
Сommit
bfa845ace1
6 измененных файлов с 17 добавлено и 13 удалено
  1. 0 8
      apps/app/.env
  2. 1 0
      apps/app/.gitignore
  3. 1 0
      apps/app/package.json
  4. 5 4
      apps/app/prisma.config.ts
  5. 1 1
      apps/app/prisma/schema.prisma
  6. 9 0
      pnpm-lock.yaml

+ 0 - 8
apps/app/.env

@@ -1,8 +0,0 @@
-# Environment variables declared in this file are NOT automatically loaded by Prisma.
-# Please add `import "dotenv/config";` to your `prisma.config.ts` file, or use the Prisma CLI with Bun
-# to load environment variables from .env files: https://pris.ly/prisma-config-env-vars.
-
-# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
-# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
-
-DATABASE_URL="mongodb+srv://root:randompassword@cluster0.ab1cd.mongodb.net/mydb?retryWrites=true&w=majority"

+ 1 - 0
apps/app/.gitignore

@@ -18,4 +18,5 @@
 # cache
 /.swc/
 
+# prisma
 /generated/prisma

+ 1 - 0
apps/app/package.json

@@ -278,6 +278,7 @@
     "@testing-library/user-event": "^14.5.2",
     "@types/archiver": "^6.0.2",
     "@types/bunyan": "^1.8.11",
+    "@types/dotenv-flow": "^3.2.0",
     "@types/express": "^4.17.21",
     "@types/hast": "^3.0.4",
     "@types/js-cookie": "^3.0.6",

+ 5 - 4
apps/app/prisma.config.ts

@@ -1,8 +1,9 @@
-// This file was generated by Prisma and assumes you have installed the following:
-// npm install --save-dev prisma dotenv
-import 'dotenv/config';
+import { config } from 'dotenv-flow';
 import { defineConfig, env } from 'prisma/config';
 
+config();
+
+// biome-ignore lint/style/noDefaultExport: prisma requires a default export
 export default defineConfig({
   schema: 'prisma/schema.prisma',
   migrations: {
@@ -10,6 +11,6 @@ export default defineConfig({
   },
   engine: 'classic',
   datasource: {
-    url: env('DATABASE_URL'),
+    url: env('MONGO_URI'),
   },
 });

+ 1 - 1
apps/app/prisma/schema.prisma

@@ -11,5 +11,5 @@ generator client {
 
 datasource db {
   provider = "mongodb"
-  url      = env("DATABASE_URL")
+  url      = env("MONGO_URI")
 }

+ 9 - 0
pnpm-lock.yaml

@@ -794,6 +794,9 @@ importers:
       '@types/bunyan':
         specifier: ^1.8.11
         version: 1.8.11
+      '@types/dotenv-flow':
+        specifier: ^3.2.0
+        version: 3.2.0
       '@types/express':
         specifier: ^4.17.21
         version: 4.17.21
@@ -5408,6 +5411,9 @@ packages:
   '@types/debug@4.1.7':
     resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}
 
+  '@types/dotenv-flow@3.2.0':
+    resolution: {integrity: sha512-A79hbPwocbYkcTwGcDOFbKDuqyVo5mLAz/6Iq465YZ7R7Go5bT1PIM8I2jlPQkaD9u9fbotGVLkUPhX+9XUHfw==}
+
   '@types/es-aggregate-error@1.0.6':
     resolution: {integrity: sha512-qJ7LIFp06h1QE1aVxbVd+zJP2wdaugYXYfd6JxsyRMrYHaxb6itXPogW2tz+ylUJ1n1b+JF1PHyYCfYHm0dvUg==}
 
@@ -6298,6 +6304,7 @@ packages:
   basic-ftp@5.0.5:
     resolution: {integrity: sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==}
     engines: {node: '>=10.0.0'}
+    deprecated: Security vulnerability fixed in 5.2.0, please upgrade
 
   batch@0.6.1:
     resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==}
@@ -20180,6 +20187,8 @@ snapshots:
     dependencies:
       '@types/ms': 0.7.31
 
+  '@types/dotenv-flow@3.2.0': {}
+
   '@types/es-aggregate-error@1.0.6':
     dependencies:
       '@types/node': 20.19.17