This commit is contained in:
Leandro Facchinetti 2021-03-13 23:47:28 +00:00
parent 07d722cc2a
commit 8792d03f18
4 changed files with 15 additions and 20 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/node_modules/
/lib/
/kill-the-newsletter.db
/data/

View File

@ -1,6 +1,9 @@
module.exports = (require) => {
const path = require("path");
const killTheNewsletter = require(".").default;
const { webApplication, emailApplication } = killTheNewsletter(__dirname);
const { webApplication, emailApplication } = killTheNewsletter(
path.join(__dirname, "data")
);
webApplication.listen(new URL(webApplication.get("url")).port, () => {
console.log(`Web server started at ${webApplication.get("url")}`);

View File

@ -1,16 +1,16 @@
module.exports = async (require) => {
const path = require("path");
const express = require("express");
const cookieSession = require("cookie-session");
const { sql } = require("@leafac/sqlite");
const AutoEncrypt = require("@small-tech/auto-encrypt");
const courselore = require(".").default;
const customization = require(path.join(__dirname, "customization"))(require);
const killTheNewsletter = require(".").default;
const app = await courselore(__dirname);
const { webApplication, emailApplication } = killTheNewsletter(
path.join(__dirname, "data")
);
app.set("url", "https://courselore.org");
app.set("administrator", "mailto:administrator@courselore.org");
webApplication.set("url", "https://kill-the-newsletter.com");
webApplication.set("email", "smtp://kill-the-newsletter.com:25");
webApplication.set("administrator", "mailto:kill-the-newsletter@leafac.com");
const reverseProxy = express();
@ -19,19 +19,11 @@ module.exports = async (require) => {
return res.redirect(`${app.get("url")}${req.originalUrl}`);
next();
});
reverseProxy.use(cookieSession({ secret: app.get("cookie secret") }));
reverseProxy.use(customization(app));
reverseProxy.use(app);
AutoEncrypt.https
.createServer(
{
domains: [
"courselore.org",
"www.courselore.org",
"courselore.com",
"www.courselore.com",
],
domains: ["kill-the-newsletter.com", "www.kill-the-newsletter.com"],
settingsPath: path.join(__dirname, "data/keys/tls"),
},
reverseProxy

View File

@ -1,9 +1,9 @@
[Unit]
Description=Courselore
Description=Kill the Newsletter!
After=network.target
[Service]
ExecStart=/root/courselore/courselore /root/courselore/configuration.js
ExecStart=/root/kill-the-newsletter/kill-the-newsletter /root/kill-the-newsletter/configuration.js
Environment=NODE_ENV=production
User=root
Restart=always