Unknown Changes

This commit is contained in:
2022-07-03 19:29:17 +02:00
parent 70f536d8a4
commit 74ce54d861
13 changed files with 355 additions and 12 deletions

1
util/botConfig.js Normal file
View File

@@ -0,0 +1 @@
const db = require("../util/db")

33
util/db.js Normal file
View File

@@ -0,0 +1,33 @@
require("dotenv").config();
const mysql = require("mysql2/promise")
let _db;
async function connect() {
const host = process.env.NODE_ENV === "production"
try {
const connection = await mysql.createConnection({
"host" : process.env.DB_HOST,
"port" : 3306,
"user" : process.env.DB_USERNAME,
"password" : process.env.DB_PASSWORD,
"database" : process.env.DB_DATABASE
});
_db = connection;
} catch (err) {
console.log(err);
}
}
function initDb() {
connect();
}
function getDb() {
return _db;
}
module.exports = {
initDb,
getDb
}

0
util/twitch.js Normal file
View File