SSL code snippets and backing comments

skysql_field
Rob Hedgpeth 2020-03-31 10:01:33 -05:00
rodzic 5bf7a082fa
commit 0bfa252339
4 zmienionych plików z 45 dodań i 19 usunięć

Wyświetl plik

@ -1,6 +1,12 @@
var mariadb = require('mariadb'); var mariadb = require('mariadb');
require('dotenv').config(); require('dotenv').config();
// SSL (e.g. SkySQL) connections
// * Remember to change the location of "skysql_chain.pem" to wherever you placed it!
// * To use just uncomment the two lines below and the 'ssl' property (and value)
//const fs = require("fs");
//const serverCert = [fs.readFileSync("skysql_chain.pem", "utf8")];
const pool = mariadb.createPool({ const pool = mariadb.createPool({
host: process.env.DB_HOST, host: process.env.DB_HOST,
@ -9,11 +15,11 @@ const pool = mariadb.createPool({
port: process.env.DB_PORT, port: process.env.DB_PORT,
multipleStatements: true, multipleStatements: true,
connectionLimit: 5 connectionLimit: 5
/*timezone: 'UTC', // For SSL (e.g. SkySQL) connections
dateStrings: [ /*
'DATE', ,ssl: {
'DATETIME' ca: serverCert
]*/ }*/
}); });

Wyświetl plik

@ -1,6 +1,13 @@
var mariadb = require('mariadb'); var mariadb = require('mariadb');
require('dotenv').config(); require('dotenv').config();
// SSL (e.g. SkySQL) connections
// * Remember to change the location of "skysql_chain.pem" to wherever you placed it!
// * To use just uncomment the two lines below and the 'ssl' property (and value)
//const fs = require("fs");
//const serverCert = [fs.readFileSync("skysql_chain.pem", "utf8")];
const pool = mariadb.createPool({ const pool = mariadb.createPool({
host: process.env.DB_HOST, host: process.env.DB_HOST,
user: process.env.DB_USER, user: process.env.DB_USER,
@ -9,6 +16,11 @@ const pool = mariadb.createPool({
database: process.env.DB_NAME, database: process.env.DB_NAME,
multipleStatements: true, multipleStatements: true,
connectionLimit: 5 connectionLimit: 5
// For SSL (e.g. SkySQL) connections
/*
,ssl: {
ca: serverCert
}*/
}); });
module.exports={ module.exports={

Wyświetl plik

@ -1,8 +1,11 @@
const fs = require("fs");
var mariadb = require('mariadb'); var mariadb = require('mariadb');
require('dotenv').config(); require('dotenv').config();
// For SSL connections // SSL (e.g. SkySQL) connections
// * Remember to change the location of "skysql_chain.pem" to wherever you placed it!
// * To use just uncomment the two lines below and the 'ssl' property (and value)
//const fs = require("fs");
//const serverCert = [fs.readFileSync("skysql_chain.pem", "utf8")]; //const serverCert = [fs.readFileSync("skysql_chain.pem", "utf8")];
var pools = [ var pools = [
@ -14,19 +17,12 @@ var pools = [
database: process.env.DB_NAME_1, database: process.env.DB_NAME_1,
multipleStatements: true, multipleStatements: true,
connectionLimit: 5 connectionLimit: 5
})/*, // For SSL (e.g. SkySQL) connections
mariadb.createPool({ /*
host: '<host_address>', ,ssl: {
user:'<user>',
password: '<password>',
database: 'orders',
port: 5002,
multipleStatements: true,
connectionLimit: 5,
ssl: {
ca: serverCert ca: serverCert
} }*/
})*/ })
]; ];
module.exports={ module.exports={

Wyświetl plik

@ -1,6 +1,13 @@
var mariadb = require('mariadb'); var mariadb = require('mariadb');
require('dotenv').config(); require('dotenv').config();
// SSL (e.g. SkySQL) connections
// * Remember to change the location of "skysql_chain.pem" to wherever you placed it!
// * To use just uncomment the two lines below and the 'ssl' property (and value)
//const fs = require("fs");
//const serverCert = [fs.readFileSync("skysql_chain.pem", "utf8")];
const pool = mariadb.createPool({ const pool = mariadb.createPool({
host: 'localhost', host: 'localhost',
user:'root', user:'root',
@ -8,6 +15,11 @@ const pool = mariadb.createPool({
database: 'Places', database: 'Places',
multipleStatements: true, multipleStatements: true,
connectionLimit: 5 connectionLimit: 5
// For SSL (e.g. SkySQL) connections
/*
,ssl: {
ca: serverCert
}*/
}); });
const pool = mariadb.createPool({ const pool = mariadb.createPool({