diff --git a/engine/engine/utils/dbHandler.js b/engine/engine/utils/dbHandler.js index 6101d13..fa3cd2f 100644 --- a/engine/engine/utils/dbHandler.js +++ b/engine/engine/utils/dbHandler.js @@ -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; + // } + // })(), + // }, }); ////////////////////////////////////////////////////////////////////////////////// diff --git a/engine/engine/utils/noDatabaseDbHandler.js b/engine/engine/utils/noDatabaseDbHandler.js index d950cba..d757cae 100644 --- a/engine/engine/utils/noDatabaseDbHandler.js +++ b/engine/engine/utils/noDatabaseDbHandler.js @@ -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`, }, }); diff --git a/package.json b/package.json index 6133da1..213d001 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/ssl/ca-cert.pem b/ssl/ca-cert.pem new file mode 100644 index 0000000..dad48e5 --- /dev/null +++ b/ssl/ca-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDnTCCAoWgAwIBAgIUVruYX02DdRIrbHXkrlz1LkntCYowDQYJKoZIhvcNAQEL +BQAwXTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEWMBQGA1UEAwwNTWFyaWFEQiBhZG1p +bjAgFw0yNDAxMDkxNTAxMjFaGA8zMDIzMDUxMjE1MDEyMVowXTELMAkGA1UEBhMC +QVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdp +dHMgUHR5IEx0ZDEWMBQGA1UEAwwNTWFyaWFEQiBhZG1pbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAMIpgpOT66kqbr4AS3BKlEFY6U+OtGuWmC2RPLYq +moZ3WXNrgqL4ymhe/mdIJgr4PPjVnuwgDElRw0v1Vrnf9Gg4Dy1zWIXIGKxF4Cu9 +UGK546xtVnn8f7DPjdPKSmZN0iZh3Z+1Pu/P3a62dJ30c+rcUw/pPq2aGWNY/iWo +MtCVxTjTl92+gR1tRfXw88xHW/v4ly+GeijC6v5WX3qad8sTZR6CNLzGXQRe8hU+ +pYrXURGTb5YZTaDe9SuvYZtflfl8AtSlMwGX7Bk6BJI9ROTLbgb9zp2zzC8TvDWu +dXvnaIJyCwHo43iONw2KK67IAp2Q2Z6acFqQVOUsqoD7wi8CAwEAAaNTMFEwHQYD +VR0OBBYEFBlkPD5aW+FrgzCF0AypGvTvEPmEMB8GA1UdIwQYMBaAFBlkPD5aW+Fr +g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