forked from dsc-srmrmp/discordbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrizzle.config.js
More file actions
30 lines (28 loc) · 809 Bytes
/
Copy pathdrizzle.config.js
File metadata and controls
30 lines (28 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/** @format */
try {
require("dotenv").config({ path: ".env" });
} catch (e) {
const fs = require("fs");
if (fs.existsSync(".env")) {
const content = fs.readFileSync(".env", "utf8");
for (const line of content.split("\n")) {
const match = line.trim().match(/^([^=]+)=(.*)$/);
if (match) {
const key = match[1].trim();
let val = match[2].trim();
if (val.startsWith('"') && val.endsWith('"')) val = val.slice(1, -1);
if (val.startsWith("'") && val.endsWith("'")) val = val.slice(1, -1);
process.env[key] = val;
}
}
}
}
/** @type {import('drizzle-kit').Config} */
module.exports = {
schema: "./src/db/schema.js",
out: "./src/db/migrations",
dialect: "postgresql",
dbCredentials: {
url: process.env.DATABASE_URL,
},
};