From c1c8959060d0d9fecdce944c5101e92f95fe5985 Mon Sep 17 00:00:00 2001 From: IanR01 Date: Thu, 28 Mar 2024 16:41:04 +0100 Subject: [PATCH] use dialectOptions --- db.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/db.js b/db.js index 9dd0935..a97debf 100755 --- a/db.js +++ b/db.js @@ -4,17 +4,21 @@ const { Sequelize } = require('sequelize'); var getAzureAuthToken = require('./azure-auth') -let ssl; +let dialectOptions; if (process.env.MYSQL_CA_CERT) { - ssl = { - ca: process.env.MYSQL_CA_CERT + dialectOptions = { + ssl: { + ca: process.env.MYSQL_CA_CERT + } } } if (process.env.AZURE_CLIENT_ID) { - ssl = { - require: true - } + dialectOptions = { + ssl: { + require: true + } + } } let sequelize = new Sequelize({ @@ -34,9 +38,8 @@ let sequelize = new Sequelize({ username: process.env.DB_USER, port: process.env.DB_PORT || '3306', - ssl, - dialect: process.env.DB_DIALECT || 'mysql', + dialectOptions, logging: null, // logging: console.log,