mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
add more debug tools, and email me on error
This commit is contained in:
36
server.js
36
server.js
@@ -1,6 +1,38 @@
|
||||
/*process.on('uncaughtException', function (error) {
|
||||
process.on('uncaughtException', function (error) {
|
||||
|
||||
function sendEmail(mailData) {
|
||||
var nodemailer = require("derby-auth/node_modules/nodemailer");
|
||||
|
||||
// create reusable transport method (opens pool of SMTP connections)
|
||||
// TODO derby-auth isn't currently configurable here, if you need customizations please send pull request
|
||||
var smtpTransport = nodemailer.createTransport("SMTP",{
|
||||
service: process.env.SMTP_SERVICE,
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS
|
||||
}
|
||||
});
|
||||
|
||||
// send mail with defined transport object
|
||||
smtpTransport.sendMail(mailData, function(error, response){
|
||||
if(error){
|
||||
console.log(error);
|
||||
}else{
|
||||
console.log("Message sent: " + response.message);
|
||||
}
|
||||
|
||||
smtpTransport.close(); // shut down the connection pool, no more messages
|
||||
});
|
||||
}
|
||||
|
||||
sendEmail({
|
||||
from: "HabitRPG <admin@habitrpg.com>",
|
||||
to: "tylerrenelle@gmail.com",
|
||||
subject: "HabitRPG Error",
|
||||
text: error.stack
|
||||
});
|
||||
console.log(error.stack);
|
||||
});*/
|
||||
});
|
||||
|
||||
require('coffee-script') // remove intermediate compilation requirement
|
||||
require('./src/server').listen(process.env.PORT || 3000);
|
||||
|
||||
Reference in New Issue
Block a user