const mysql = require('mysql');

// Database connection localhost using .env file
const db = mysql.createConnection({
  host: process.env.DB_HOST,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_DBNAME
});

// // Database connection localhost
// const db = mysql.createConnection({
//   host: 'localhost',
//   user: 'root',
//   password: '',
//   database: 'predictmycity_firedb'
// });


// // Database connection Efrontier.com predictmycity
// const db = mysql.createConnection({
//   host: 'localhost',
//   user: 'efront6_predict',
//   password: 'Fireball@1',
//   database: 'efront6_test',
// });

// // Database connection predictmycity - LIVE
// const db = mysql.createConnection({
//   host: 'localhost',
//   user: 'predictmycity_dbmaster',
//   password: '%191O9DB#Eua',
//   database: 'predictmycity_firedb'
// });

db.connect((err) => {
  if (err) {
    console.error('error connecting:', err);
    return;
  }
  console.log('connected as id ' + db.threadId);
});

module.exports = db;

