mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 17:59:25 +00:00
Use importJSON instead of hardcoded require
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user