import mysql from 'mysql2' var env = process.env.NODE_ENV || 'testing' const config = require('./config')[env] // ==== USER ACOOUNT DB CONNECTION ==== const userConnection = mysql.createPool({ host: config.database.host, user: config.database.user, password: config.database.password, port: config.database.port, database: config.database.dbUser, waitForConnections: true, connectionLimit: 10, queueLimit: 0 }); userConnection.query('USE '+config.database.dbUser) // ==== PROJECT DB CONNECTION ==== const projectConnection = mysql.createPool({ host: config.database.host_project, user: config.database.user, password: config.database.password, port: config.database.port, database: config.database.dbProject, waitForConnections: true, connectionLimit: 10, queueLimit: 0 }); projectConnection.query('USE '+config.database.dbProject) const connection = { user: userConnection, project: projectConnection } export = connection