-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from CBIIT/Bento-1822
BENTO-1872, BENTO-1822
- Loading branch information
Showing
12 changed files
with
455 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ sessions/ | |
.idea/ | ||
logs/ | ||
yaml/ | ||
newrelic_agent.log | ||
newrelic_agent.log | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
COOKIE_SECRET=XXXXX | ||
SESSION_TIMEOUT=1200 | ||
VERSION=1.0 | ||
DATE=2022.05.19 | ||
# MySQL Configuration | ||
MY_SQL_HOST=127.0.0.1 | ||
MY_SQL_PORT=3306 | ||
MY_SQL_PASSWORD=Dbtldud1 | ||
MY_SQL_USER=root | ||
MY_SQL_DATABASE=session | ||
# Email Notification Config | ||
EMAIL_SERVICE_EMAIL=XXXX@nih.gov | ||
EMAIL_SMTP_HOST=mailfwd.nih.gov | ||
EMAIL_SMTP_PORT=25 | ||
# If Sent From AWS SMTP | ||
#EMAIL_USER=XXXX | ||
#EMAIL_PASSWORD=XXXX | ||
NEO4J_URI=bolt://localhost:XXXX | ||
NEO4J_USER=neo4j | ||
NEO4J_PASSWORD=xxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const fsp = require('fs/promises'); | ||
const path = require('path'); | ||
const { template } = require('lodash'); | ||
|
||
async function createEmailTemplate(templateName, params, basePath = 'templates') { | ||
const templatePath = path.resolve(basePath, templateName); | ||
const templateSource = await fsp.readFile(templatePath, "utf-8"); | ||
return template(templateSource)(params); | ||
} | ||
|
||
module.exports = {createEmailTemplate} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use strict"; | ||
const nodemailer = require("nodemailer"); | ||
const config = require("../config"); | ||
const {sendNotification} = require("../services/notify"); | ||
|
||
module.exports = { | ||
/* | ||
Sends an email to the provided recipient | ||
Arguments: | ||
- recipient {array of strings} -- recipients of the email | ||
- subject {string} -- The email's subject | ||
- contents {string} -- The email's contents | ||
*/ | ||
sendEmail: async (recipient, subject, contents) => { | ||
// create reusable transporter object using the default SMTP transport | ||
let info = await sendNotification({ | ||
from: config.email_service_email, | ||
to: recipient, | ||
// cc: [], | ||
// bcc: [], | ||
subject: subject, | ||
html: contents, | ||
}); | ||
|
||
console.log("Message sent: %s", info.messageId); | ||
// Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com> | ||
|
||
// Preview only available when sending through an Ethereal account | ||
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info)); | ||
// Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou... | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function withAsync(fn) { | ||
return async (request, response, next) => { | ||
try { | ||
return await fn(request, response, next); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
} | ||
|
||
module.exports = { | ||
withAsync | ||
}; |
Oops, something went wrong.