Added test to var coming from settings.json file to avoid errors

This commit is contained in:
quenenni 2013-04-04 14:57:54 +02:00
parent 66f1f7f2c3
commit 75578aa676
2 changed files with 10 additions and 10 deletions

View file

@ -6,10 +6,10 @@ randomString = require('../../src/static/js/pad_utils').randomString;
settings = require('../../src/node/utils/Settings');
var pluginSettings = settings.ep_email_notifications;
var fromName = pluginSettings.fromName || "Etherpad";
var fromEmail = pluginSettings.fromEmail || "pad@etherpad.org";
var urlToPads = pluginSettings.urlToPads || "http://beta.etherpad.org/p/";
var emailServer = pluginSettings.emailServer || {host:"127.0.0.1"};
var fromName = (pluginSettings && pluginSettings.fromName)?pluginSettings.fromName:"Etherpad";
var fromEmail = (pluginSettings && pluginSettings.fromEmail)?pluginSettings.fromEmail:"pad@etherpad.org";
var urlToPads = (pluginSettings && pluginSettings.urlToPads)?pluginSettings.urlToPads:"http://beta.etherpad.org/p/";
var emailServer = (pluginSettings && pluginSettings.emailServer)?pluginSettings.emailServer:{host:"127.0.0.1"};
// Connect to the email server -- This might not be the ideal place to connect but it stops us having lots of connections
var server = email.server.connect(emailServer);

View file

@ -8,12 +8,12 @@ settings = require('../../src/node/utils/Settings');
// Settings -- EDIT THESE IN settings.json not here..
var pluginSettings = settings.ep_email_notifications;
var checkFrequency = pluginSettings.checkFrequency || 60000; // 10 seconds
var staleTime = pluginSettings.staleTime || 300000; // 5 minutes
var fromName = pluginSettings.fromName || "Etherpad";
var fromEmail = pluginSettings.fromEmail || "pad@etherpad.org";
var urlToPads = pluginSettings.urlToPads || "http://beta.etherpad.org/p/";
var emailServer = pluginSettings.emailServer || {host:"127.0.0.1"};
var checkFrequency = (pluginSettings && pluginSettings.checkFrequency)?pluginSettings.checkFrequency:60000; // 10 seconds
var staleTime = (pluginSettings && pluginSettings.staleTime)?pluginSettings.staleTime:300000; // 5 minutes
var fromName = (pluginSettings && pluginSettings.fromName)?pluginSettings.fromName:"Etherpad";
var fromEmail = (pluginSettings && pluginSettings.fromEmail)?pluginSettings.fromEmail:"pad@etherpad.org";
var urlToPads = (pluginSettings && pluginSettings.urlToPads)?pluginSettings.urlToPads:"http://beta.etherpad.org/p/";
var emailServer = (pluginSettings && pluginSettings.emailServer)?pluginSettings.emailServer:{host:"127.0.0.1"};
// A timer object we maintain to control how we send emails
var timers = {};