Minor Updates

This commit is contained in:
Benjamin Toby
2024-11-07 15:28:28 +01:00
parent 880a74dbcb
commit 8fd6c28461
9 changed files with 42 additions and 95 deletions
@@ -138,6 +138,13 @@ async function addDbEntry({
if (value == null || value == undefined) continue;
if (
targetFieldSchema?.dataType?.match(/int$/i) &&
typeof value == "string" &&
!value?.match(/./)
)
continue;
if (targetFieldSchema?.encrypted) {
value = encrypt(value, encryptionKey, encryptionSalt);
console.log("DSQL: Encrypted value =>", value);
@@ -4,10 +4,7 @@ const fs = require("fs");
const serverError = require("./serverError");
const mysql = require("serverless-mysql");
const path = require("path");
const SSL_DIR =
process.env.DSQL_SSL_DIR || path.resolve(__dirname, "../../../ssl");
const grabDbSSL = require("../../utils/backend/grabDbSSL");
const connection = mysql({
config: {
@@ -16,9 +13,7 @@ const connection = mysql({
password: process.env.DSQL_DB_PASSWORD,
database: process.env.DSQL_DB_NAME,
charset: "utf8mb4",
ssl: {
ca: fs.readFileSync(`${SSL_DIR}/ca-cert.pem`),
},
ssl: grabDbSSL(),
},
});