Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dbmanager.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const mysql = require('mysql');
const logmanager = require('./logmanager.js');
const { sql_enabled, sql_host, sql_user, sql_password, sql_port, sql_dbname } = require('./config.json');

/**
* Connects to a MySQL Database using credentials from config.json
* Returns a MySQL Connection instance
*/
function connectToDatabase() {
if (!sql_enabled) {
Expand All @@ -18,7 +20,7 @@ function connectToDatabase() {

con.connect(function (err) {
if (err) throw err;
console.log(`Connected to MySQL Database ${sql_dbname} at ${sql_user}@${sql_host}:${sql_port}`);
logmanager.info(`Connected to MySQL Database ${sql_dbname} at ${sql_user}@${sql_host}:${sql_port}`);
});
return con;
}
Expand Down
7 changes: 3 additions & 4 deletions routemanager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require('node:fs');
const path = require('node:path');
const fs = require('fs');
const path = require('path');
const logmanager = require('./logmanager.js');

/**
Expand Down Expand Up @@ -98,8 +98,7 @@ function loadRoutes(app) {
res.render(route.pugfile, options, function (err, html) {
logmanager.debug(`Route called: ${route.urlpath} with title: ${options.title}`);
if (err) {
console.log(err);
return;
throw err;
}

/**
Expand Down