1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 22:19:26 +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 // Import required modules
const mysql = require('mysql2/promise'); 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 // Import the database connection options from config/db.json
let defaultDbOptions; const defaultDbOptions = importJSON('db');
try {
defaultDbOptions = require(
path.join(__dirname, '../config/db.json'));
} catch (e) {
console.log(e);
throw new Error('Missing or malformed config ' +
'(config/db.json)');
}
/** /**
* A class representing a pool of database connections * A class representing a pool of database connections