Use redis session store
This commit is contained in:
parent
8cbf946715
commit
4dd14bb624
5
app.js
5
app.js
@ -9,9 +9,12 @@ const path = require('path')
|
||||
const toml = require('toml')
|
||||
const fs = require('fs')
|
||||
const uuid = require('uuid/v4')
|
||||
const connectSession = require('connect-redis')
|
||||
|
||||
require('express-async-errors')
|
||||
|
||||
const SessionStore = connectSession(session)
|
||||
|
||||
const util = require('util')
|
||||
const get = util.promisify(request.get)
|
||||
const post = util.promisify(request.post)
|
||||
@ -91,9 +94,11 @@ nunjucks.configure('templates', {
|
||||
})
|
||||
|
||||
app.use(session({
|
||||
key: 'Streamserver Session',
|
||||
secret: config['Streaming']['Secret'],
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
store: new SessionStore(),
|
||||
cookie: {
|
||||
secure: !dev,
|
||||
maxAge: 2678400000 // 1 month
|
||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -1190,6 +1190,11 @@
|
||||
"xdg-basedir": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"connect-redis": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/connect-redis/-/connect-redis-4.0.3.tgz",
|
||||
"integrity": "sha512-Php0P0ShNfilW6f2d/2v7Q0VAiFeBYsg0bIgu8ST3x26CcQ1JtzV6vxPLUwK0uiq10hQSMR+HzSNhWbcvx6nLg=="
|
||||
},
|
||||
"console-browserify": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz",
|
||||
|
@ -21,6 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.18.3",
|
||||
"connect-redis": "^4.0.3",
|
||||
"ejs": "^2.6.1",
|
||||
"express": "^4.16.4",
|
||||
"express-async-errors": "^3.1.1",
|
||||
|
Reference in New Issue
Block a user