Skip to content

Commit

Permalink
use dialectOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
IanR01 committed Mar 28, 2024
1 parent 1939f26 commit c1c8959
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions db.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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,
Expand Down

0 comments on commit c1c8959

Please sign in to comment.