remove redis, stick to static variables

This commit is contained in:
Lio Young 2021-10-19 12:18:47 +02:00
parent 3c28bd4b3f
commit 5995bdd157

View file

@ -6,37 +6,9 @@ const cors = require("cors");
const morgan = require("morgan");
const chalk = require("chalk");
const hbs = require("express-handlebars");
const { dev, allMusic, music, port, socials, name } = require("./c");
const redis = require("ioredis");
const { promisify } = require("util");
const {
compileSassAndSaveMultiple,
setupCleanupOnExit,
} = require("compile-sass");
const path = require("path");
// Init
const { dev, allMusic, music, port, socials, name } = require("./configs");
const app = express();
const r = new redis(6379, "192.168.1.11", {
connectionName: `ALEXHELDT${dev ? "-dev" : ""}`,
});
const get = promisify(r.get).bind(r);
compileSassAndSaveMultiple({
sassPath: path.join(__dirname, "assets/sass/"),
cssPath: path.join(__dirname, "assets/css/"),
files: ["index.sass"],
});
process.on("SIGINT", () => {
try {
setupCleanupOnExit("assets/css");
console.log("worked");
process.exit(0);
} catch (error) {
console.error(error);
process.exit(1);
}
});
app.engine("hbs", hbs({ extname: "hbs", defaultView: "default" }));
app.set("view engine", "hbs");
@ -72,8 +44,8 @@ app.get("/", async (req, res) => {
socials,
music,
creator: {
name: (await r.get("creator_name")) || "lio",
website: (await r.get("creator_website")) || "https://himbo.cat",
name: "temere",
website: "https://teme.re",
},
});
});