This commit is contained in:
Benjamin Toby 2024-01-18 16:46:15 +01:00
parent 0e95334ef7
commit 05ba95342c
4 changed files with 43 additions and 25 deletions

View File

@ -18,9 +18,10 @@
////////////////////////////////////////
////////////////////////////////////////
const fs = require("fs");
const mysql = require("mysql");
const parseDbResults = require("./parseDbResults");
const path = require("path");
const SSL_PATH = path.resolve(__dirname, "../../../ssl");
const connection = mysql.createConnection({
host: process.env.DSQL_HOST,
@ -33,17 +34,20 @@ const connection = mysql.createConnection({
: undefined,
timeout: 5000,
ssl: {
ca: (() => {
try {
if (process.env.DSQL_SSL_CA_PATH) {
return fs.readFileSync(process.env.DSQL_SSL_CA_PATH);
}
return undefined;
} catch (error) {
return undefined;
}
})(),
ca: `${SSL_PATH}/ca-cert.pem`,
},
// ssl: {
// ca: (() => {
// try {
// if (process.env.DSQL_SSL_CA_PATH) {
// return fs.readFileSync(process.env.DSQL_SSL_CA_PATH);
// }
// return undefined;
// } catch (error) {
// return undefined;
// }
// })(),
// },
});
//////////////////////////////////////////////////////////////////////////////////

View File

@ -1,9 +1,10 @@
// @ts-check
const fs = require("fs");
const dbHandler = require("./dbHandler");
const mysql = require("mysql");
const endConnection = require("./endConnection");
const path = require("path");
const SSL_PATH = path.resolve(__dirname, "../../../ssl");
const connection = mysql.createConnection({
host: process.env.DSQL_HOST,
@ -15,16 +16,7 @@ const connection = mysql.createConnection({
: undefined,
timeout: 5000,
ssl: {
ca: (() => {
try {
if (process.env.DSQL_SSL_CA_PATH) {
return fs.readFileSync(process.env.DSQL_SSL_CA_PATH);
}
return undefined;
} catch (error) {
return undefined;
}
})(),
ca: `${SSL_PATH}/ca-cert.pem`,
},
});

View File

@ -1,6 +1,6 @@
{
"name": "datasquirel",
"version": "1.9.8",
"version": "1.9.9",
"description": "Cloud-based SQL data management tool",
"main": "index.js",
"bin": {

22
ssl/ca-cert.pem Normal file
View File

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDnTCCAoWgAwIBAgIUVruYX02DdRIr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