update certificate

Signed-off-by: Walamana <joniogerg@gmail.com>
This commit is contained in:
Walamana 2017-11-27 18:06:00 +01:00
parent cd90540be2
commit a285b8e620

20
app.js
View File

@ -15,7 +15,7 @@ var con = mysql.createConnection({
password: "Wnc4q_75",
database: "minis",
ssl: {
ca: fs.readFileSync (process.cwd() + "/mysql-ca.ctf")
ca: fs.readFileSync(process.cwd() + "/mysql-ca.ctf")
}
});
@ -29,7 +29,7 @@ con.connect(err => {
app.get('/', (req, res) => {
if(!isConnected()){res.send("No Connection to database<br>" + JSON.stringify(cause) + "<br>" + toString(con));return}
if(!isConnected()){res.send("No Connection to database<br>" + JSON.stringify(cause) + "<br>" + fs.readFileSync(process.cwd() + "/mysql-ca.ctf"));return}
res.send("Welcome to the miniplan api!");
});
@ -144,22 +144,6 @@ app.listen(3000, () => {
console.log("API started!");
});
function toString(string){
var cache = [];
var r = JSON.stringify(string, function(key, value) {
if (typeof value === 'object' && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found, discard key
return;
}
// Store value in our collection
cache.push(value);
}
return value;
});
cache = null; // Enable garbage collection
return r;
}
function isConnected(){
if(con.isConnected){