1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 19:59:27 +00:00

Use importJSON instead of hardcoded require

This commit is contained in:
2022-02-13 21:54:54 +00:00
parent 7ce12f5ef4
commit 3081417a54

View File

@@ -2,18 +2,12 @@
// Import required modules
const mysql = require('mysql2/promise');
const path = require('path');
// Import user defined modules
const importJSON = require('./importJSON');
// Import the database connection options from config/db.json
let defaultDbOptions;
try {
defaultDbOptions = require(
path.join(__dirname, '../config/db.json'));
} catch (e) {
console.log(e);
throw new Error('Missing or malformed config ' +
'(config/db.json)');
}
const defaultDbOptions = importJSON('db');
/**
* A class representing a pool of database connections