This commit is contained in:
Leandro Facchinetti 2021-03-18 14:30:22 +00:00
parent 7981d7b19c
commit 4a2ed33047
2 changed files with 4 additions and 6 deletions

View File

@ -13,7 +13,6 @@ module.exports = async (require) => {
webApplication.set("administrator", "mailto:kill-the-newsletter@leafac.com"); webApplication.set("administrator", "mailto:kill-the-newsletter@leafac.com");
const reverseProxy = express(); const reverseProxy = express();
reverseProxy.use((req, res, next) => { reverseProxy.use((req, res, next) => {
if (req.hostname !== new URL(webApplication.get("url")).hostname) if (req.hostname !== new URL(webApplication.get("url")).hostname)
return res.redirect(`${webApplication.get("url")}${req.originalUrl}`); return res.redirect(`${webApplication.get("url")}${req.originalUrl}`);
@ -30,7 +29,6 @@ module.exports = async (require) => {
reverseProxy reverseProxy
) )
.listen(443); .listen(443);
emailApplication.listen(25, () => { emailApplication.listen(25, () => {
console.log("Email server started"); console.log("Email server started");
}); });

View File

@ -520,7 +520,8 @@ export default function killTheNewsletter(
if (require.main === module) { if (require.main === module) {
console.log(`Kill the Newsletter!/${VERSION}`); 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) { if (configurationFile === undefined) {
const { webApplication, emailApplication } = killTheNewsletter( const { webApplication, emailApplication } = killTheNewsletter(
path.join(process.cwd(), "data") path.join(process.cwd(), "data")
@ -532,8 +533,7 @@ if (require.main === module) {
console.log(`Email server started at ${webApplication.get("email")}`); console.log(`Email server started at ${webApplication.get("email")}`);
}); });
} else { } else {
const configurationFileAbsolute = path.resolve(configurationFile); require(configurationFile)(require);
require(configurationFileAbsolute)(require); console.log(`Configuration loaded from ${configurationFile}.`);
console.log(`Configuration loaded from ${configurationFileAbsolute}.`);
} }
} }