mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 16:36:28 +00:00
18 lines
468 B
JavaScript
18 lines
468 B
JavaScript
const knex = require("knex");
|
|
const { observePool } = require("./pool-metrics");
|
|
require("dotenv").config();
|
|
|
|
const knexfile = require("../../knexfile");
|
|
|
|
const env = process.env.NODE_ENV || "production";
|
|
|
|
// if running unit testing, please change the configOptions to knexfile["testing"]
|
|
|
|
const configOptions = knexfile[env];
|
|
// const configOptions = knexfile["testing"];
|
|
|
|
|
|
const db = knex(configOptions);
|
|
observePool('primary', db.client.pool);
|
|
module.exports = db;
|