Files
Online-Topup-V1/infrastructure/database/knex.js
T
Mohamad Ihsan 3902a74d6f Align transaction and log timestamps with Jakarta time
Keep recovered Load Balance writes and card audit atomic, and isolate Payment Recon tests.
2026-11-24 22:57:32 +07:00

19 lines
561 B
JavaScript

const knex = require("knex");
const { observePool } = require("./pool-metrics");
const { withTransactionTimeZone } = require("../transaction-time");
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(withTransactionTimeZone(configOptions));
observePool('primary', db.client.pool);
module.exports = db;