From 3dcda3b2772a1bfc8f8e6685ac03a9895dbed2ca Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 26 Jun 2022 20:31:28 +0530 Subject: setting cookie domain using a global config file --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server.js') diff --git a/server.js b/server.js index 50ab058c..dc9db265 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,6 @@ const port = process.env.PORT || 3000; const connectionURL = process.env.DATABASE_URL; const cron = require("node-cron"); const subdomains = require("wildcard-subdomains"); - require("dotenv").config(); // Middleware @@ -21,9 +20,11 @@ app.use( expressSession({ cookie: { maxAge: 30 * 24 * 60 * 60 * 1000, - domain: ".thatcomputerscientist.com", + domain: require("yaml").parse(require("fs").readFileSync("config.yml", "utf8")).domain, }, secret: process.env.AUTHORIZATION_STRING, + resave: true, + saveUninitialized: true }) ); app.use(flash()); -- cgit v1.2.3