notherbase-fs 4.0.15 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/notherbase-fs.js +12 -8
  2. package/package.json +1 -1
package/notherbase-fs.js CHANGED
@@ -19,6 +19,16 @@ import MongoStore from 'connect-mongo';
19
19
  class NotherBaseFS {
20
20
  constructor(globals = {}, bases = {}) {
21
21
  this.bases = bases;
22
+
23
+ this.app = express();
24
+ this.server = http.createServer(this.app);
25
+ this.io = new Server(this.server);
26
+ this.spiritWorld = new SpiritWorld(this.io);
27
+ this.creation = new Creation(bases);
28
+
29
+ //be safe, needs to be before session
30
+ if (process.env.PRODUCTION == "true") this.app.set('trust proxy', 1);
31
+
22
32
  let baseKeys = Object.keys(this.bases);
23
33
  let mongoStore = MongoStore.create({ mongoUrl: process.env.MONGODB_URI });
24
34
  for (let i = 0; i < baseKeys.length; i++) {
@@ -30,18 +40,13 @@ class NotherBaseFS {
30
40
  name: baseKeys[i] + '-session-id',
31
41
  resave: false,
32
42
  saveUninitialized: false,
43
+ proxy: process.env.PRODUCTION == "true",
33
44
  cookie: {
34
45
  secure: process.env.PRODUCTION == "true",
35
46
  maxAge: 1000 * 60 * 60 * 24 * 28 // 28 days
36
47
  }
37
48
  });
38
49
  }
39
-
40
- this.app = express();
41
- this.server = http.createServer(this.app);
42
- this.io = new Server(this.server);
43
- this.spiritWorld = new SpiritWorld(this.io);
44
- this.creation = new Creation(bases);
45
50
 
46
51
  //set views path
47
52
  this.app.set("view engine", "ejs");
@@ -71,8 +76,7 @@ class NotherBaseFS {
71
76
  this.bases[req.hosting].favicon(req, res, next);
72
77
  });
73
78
 
74
- //be safe, needs to be before session
75
- if (process.env.PRODUCTION == "true") this.app.set('trust proxy', 1);
79
+
76
80
 
77
81
  //enable cookies
78
82
  this.app.use((req, res, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notherbase-fs",
3
- "version": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "description": "Functions to help make developing for NotherBase easier.",
5
5
  "exports": "./notherbase-fs.js",
6
6
  "scripts": {