From 4a2ed330475759b42cd1e4171c1dda92a447ca9c Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Thu, 18 Mar 2021 14:30:22 +0000 Subject: [PATCH] --- deployment-example/configuration.js | 2 -- src/index.ts | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/deployment-example/configuration.js b/deployment-example/configuration.js index a099a02..c77e91b 100644 --- a/deployment-example/configuration.js +++ b/deployment-example/configuration.js @@ -13,7 +13,6 @@ module.exports = async (require) => { webApplication.set("administrator", "mailto:kill-the-newsletter@leafac.com"); const reverseProxy = express(); - reverseProxy.use((req, res, next) => { if (req.hostname !== new URL(webApplication.get("url")).hostname) return res.redirect(`${webApplication.get("url")}${req.originalUrl}`); @@ -30,7 +29,6 @@ module.exports = async (require) => { reverseProxy ) .listen(443); - emailApplication.listen(25, () => { console.log("Email server started"); }); diff --git a/src/index.ts b/src/index.ts index f32f93b..baca73d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -520,7 +520,8 @@ export default function killTheNewsletter( if (require.main === module) { console.log(`Kill the Newsletter!/${VERSION}`); - const configurationFile = process.argv[2]; + const configurationFile = + process.argv[2] === undefined ? undefined : path.resolve(process.argv[2]); if (configurationFile === undefined) { const { webApplication, emailApplication } = killTheNewsletter( path.join(process.cwd(), "data") @@ -532,8 +533,7 @@ if (require.main === module) { console.log(`Email server started at ${webApplication.get("email")}`); }); } else { - const configurationFileAbsolute = path.resolve(configurationFile); - require(configurationFileAbsolute)(require); - console.log(`Configuration loaded from ‘${configurationFileAbsolute}’.`); + require(configurationFile)(require); + console.log(`Configuration loaded from ‘${configurationFile}’.`); } }