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");
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");
});

View File

@ -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}.`);
}
}