From bc549d0a091523f7c39d3a5fc42d9f95974ddf0e Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:49:26 -0600 Subject: [PATCH] Check for SMTP module and init script on start --- scripts/server/startup.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/server/startup.js b/scripts/server/startup.js index 08ea685e..f684312d 100644 --- a/scripts/server/startup.js +++ b/scripts/server/startup.js @@ -13,6 +13,7 @@ function initServerScripts() { checkForAllRequiredModules(); initDatabaseScript(); initConfigScript(); + initEmailScript(); initClassScript(); initBitFlagScript(); initBusinessScript(); @@ -62,6 +63,16 @@ function checkForMySQLModule() { // --------------------------------------------------------------------------- +function checkForSMTPModule() { + if(typeof module.smtp == "undefined") { + return false; + } + + return true; +} + +// --------------------------------------------------------------------------- + function checkForAllRequiredModules() { logToConsole(LOG_DEBUG, "[Asshat.Startup]: Checking for required modules ..."); @@ -77,6 +88,12 @@ function checkForAllRequiredModules() { thisResource.stop(); } + if(!checkForSMTPModule()) { + console.warn("[Asshat.Startup]: SMTP Email module is not loaded!"); + console.warn("[Asshat.Startup]: This resource will now shutdown."); + thisResource.stop(); + } + logToConsole(LOG_DEBUG, "[Asshat.Startup]: All required modules loaded!"); return true; }