dbconn.js 1.15 KB
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
2
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.dbconn=void 0;var _process$env$NODE_ENV,_mysql=_interopRequireDefault(require("mysql2"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var env=null!==(_process$env$NODE_ENV=process.env.NODE_ENV)&&void 0!==_process$env$NODE_ENV?_process$env$NODE_ENV:"testing",config=require("./config")[env],userConnection=_mysql["default"].createConnection({host:config.database.host,user:config.database.user,password:config.database.password,port:config.database.port,database:config.database.dbUser,multipleStatements:!0});userConnection.connect(function(a){if(null!=a)throw a}),userConnection.query("USE "+(config.database.dbUser+""));// ==== PROJECT DB CONNECTION ====
var projectConnection=_mysql["default"].createConnection({host:config.database.host_project,user:config.database.user,password:config.database.password,port:config.database.port,database:config.database.dbProject});projectConnection.connect(function(a){if(null!=a)throw a}),projectConnection.query("USE "+(config.database.dbProject+""));var dbconn={user:userConnection,project:projectConnection};exports.dbconn=dbconn;