From 7859d8acb4f440a36ee878a64386299be14e925a Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Mon, 13 Apr 2020 20:40:27 +0200 Subject: [PATCH] fix config --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d91b637..cc1e4a2 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ const express = require("express"); const fs = require("fs"); const mysql = require("mysql"); const opn = require('opn'); -const pool = mysql.createPool(config.mysql); const app = express(); var apiOnly = false; @@ -15,6 +14,9 @@ if(!fs.existsSync(__dirname + "/static/index.html")){ apiOnly = true } +const config = JSON.parse(fs.readFileSync("./config.json", "utf-8")); +const pool = mysql.createPool(config.mysql); + function query(conn, data, params = []) { return new Promise((resolve, reject) => { conn.query(data, params, (err, resp, fields) => {