summaryrefslogtreecommitdiff
path: root/modules/email
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2024-07-22 10:43:21 +0200
committerTom Smeding <t.j.smeding@uu.nl>2024-07-22 10:43:21 +0200
commit25f68eb23dd53083e84608e2b1af2109d6a260ac (patch)
tree1d3f7e8b64e5cac8c23dc57bb68b214e26c77569 /modules/email
parent9a41d980622b449d41999dc8f46226c1879e00ef (diff)
Allow failing modules if they miss data files
Diffstat (limited to 'modules/email')
-rw-r--r--modules/email/email.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/email/email.js b/modules/email/email.js
index e4d342b..d7fe171 100644
--- a/modules/email/email.js
+++ b/modules/email/email.js
@@ -41,10 +41,16 @@ function sendEmail(recip, text) {
}
module.exports = function(app, io, moddir) {
- var allowedRecipients =
- fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n");
+ var allowedRecipients, password;
- var password = fs.readFileSync(moddir + "/password.txt").toString().trim();
+ try {
+ allowedRecipients =
+ fs.readFileSync(moddir + "/allowed_recipients.txt").toString().trim().split("\n");
+ password = fs.readFileSync(moddir + "/password.txt").toString().trim();
+ } catch (e) {
+ console.error(e);
+ return false;
+ }
app.post("/email", bodyParser.json(), function(req, res) {
var body = req.body;