Skip to content

Commit

Permalink
added code to read the file.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-rocca committed Oct 22, 2024
1 parent aa6c555 commit 9efc49d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const app = express()
const helmet = require('helmet')
const mongoose = require('mongoose')
const morgan = require('morgan')
const path = require('path')
const fs = require('fs')

const configureRoutes = require('./routes.config')
const dbUtils = require('./utils/db')
Expand Down Expand Up @@ -58,13 +60,14 @@ if (process.env.USE_AWS_CERT) {
// Connect to MongoDB database
const dbConnectionStr = dbUtils.getMongoConnectionString()
if (awsCERTFile) {
const ca = [fs.readFileSync(path.join(__dirname, 'config/global-bundle.pem'))]
mongoose.connect(dbConnectionStr, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
ssl: true,
ca: ''
sslCA: ca
})
} else {
console.log('NOT USING AWS CERT FILE')
Expand Down

0 comments on commit 9efc49d

Please sign in to comment.