初始化项目
This commit is contained in:
16
apps/server/src/db.js
Normal file
16
apps/server/src/db.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import pg from "pg";
|
||||
import { getConfig } from "./config.js";
|
||||
|
||||
const { Pool } = pg;
|
||||
|
||||
export function createPool() {
|
||||
const { database } = getConfig();
|
||||
return new Pool({
|
||||
host: database.host,
|
||||
port: database.port,
|
||||
database: database.database,
|
||||
user: database.user,
|
||||
password: database.password,
|
||||
ssl: database.ssl ? { rejectUnauthorized: false } : false
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user