changed the way configs are stored

This commit is contained in:
2017-04-27 17:22:07 +02:00
parent ce937728a5
commit ae451a5177
4 changed files with 38 additions and 15 deletions

26
js/mysql.js Normal file
View File

@@ -0,0 +1,26 @@
var mysql = require('mysql');
var fs = require("fs");
var file = null;
var connection = null;
try {
file = fs.readFileSync("./config.json");
}
catch(exception) {
console.log(exception.toString());
}
if(file != null) {
var json = JSON.parse(file);
connection = mysql.createConnection({
host: json.host,
database: json.database,
user: json.user,
password: json.password
});
}
module.exports = connection;