2024-11-05 11:12:42 +00:00
|
|
|
"use strict";
|
|
|
|
exports.id = 7487;
|
|
|
|
exports.ids = [7487];
|
|
|
|
exports.modules = {
|
|
|
|
|
|
|
|
/***/ 7487:
|
|
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
const fs = __webpack_require__(7147);
|
|
|
|
const path = __webpack_require__(1017);
|
|
|
|
const mysql = __webpack_require__(2261);
|
2024-11-06 12:06:51 +00:00
|
|
|
const SSL_DIR = process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../../ssl");
|
2024-11-05 11:12:42 +00:00
|
|
|
let NO_DB = mysql({
|
|
|
|
config: {
|
|
|
|
host: process.env.DSQL_DB_HOST,
|
|
|
|
user: process.env.DSQL_DB_USERNAME,
|
|
|
|
password: process.env.DSQL_DB_PASSWORD,
|
|
|
|
charset: "utf8mb4",
|
|
|
|
ssl: {
|
|
|
|
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* DSQL user read-only DB handler
|
|
|
|
* @param {object} params
|
|
|
|
* @param {string} params.paradigm
|
|
|
|
* @param {string} params.database
|
|
|
|
* @param {string} params.queryString
|
|
|
|
* @param {string[]} [params.queryValues]
|
|
|
|
*/ // @ts-ignore
|
|
|
|
function NO_DB_HANDLER(...args) {
|
|
|
|
try {
|
|
|
|
return new Promise((resolve, reject)=>{
|
|
|
|
NO_DB.query(...args).then((results)=>{
|
|
|
|
NO_DB.end();
|
|
|
|
resolve(JSON.parse(JSON.stringify(results)));
|
|
|
|
}).catch((err)=>{
|
|
|
|
NO_DB.end();
|
|
|
|
resolve({
|
|
|
|
error: err.message,
|
|
|
|
sql: err.sql
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (/** @type {any} */ error) {
|
|
|
|
return {
|
|
|
|
success: false,
|
|
|
|
error: error.message
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = NO_DB_HANDLER;
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
};
|
|
|
|
;
|