feat(xo-server): use memorystore
as express-session
store
This removes a warning and potential memory leaks.
This commit is contained in:
parent
47b29d5a49
commit
d78b7350b5
@ -88,6 +88,7 @@
|
||||
"limit-concurrency-decorator": "^0.4.0",
|
||||
"lodash": "^4.17.4",
|
||||
"make-error": "^1",
|
||||
"memorystore": "^1.6.2",
|
||||
"micromatch": "^4.0.2",
|
||||
"minimist": "^1.2.0",
|
||||
"moment-timezone": "^0.5.14",
|
||||
|
@ -9,6 +9,7 @@ import crypto from 'crypto'
|
||||
import has from 'lodash/has'
|
||||
import helmet from 'helmet'
|
||||
import includes from 'lodash/includes'
|
||||
import memoryStoreFactory from 'memorystore'
|
||||
import ms from 'ms'
|
||||
import proxyConsole from './proxy-console'
|
||||
import pw from 'pw'
|
||||
@ -96,10 +97,14 @@ function createExpressApp(config) {
|
||||
// Registers the cookie-parser and express-session middlewares,
|
||||
// necessary for connect-flash.
|
||||
app.use(cookieParser(null, config.http.cookies))
|
||||
const MemoryStore = memoryStoreFactory(expressSession)
|
||||
app.use(
|
||||
expressSession({
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
store: new MemoryStore({
|
||||
checkPeriod: 24 * 3600 * 1e3,
|
||||
}),
|
||||
|
||||
// TODO: should be in the config file.
|
||||
secret: 'CLWguhRZAZIXZcbrMzHCYmefxgweItKnS',
|
||||
|
10
yarn.lock
10
yarn.lock
@ -10056,7 +10056,7 @@ lower-case@^1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
|
||||
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
|
||||
|
||||
lru-cache@^4.0.1:
|
||||
lru-cache@^4.0.1, lru-cache@^4.0.3:
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd"
|
||||
integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==
|
||||
@ -10204,6 +10204,14 @@ memoizee@0.4.X:
|
||||
next-tick "1"
|
||||
timers-ext "^0.1.5"
|
||||
|
||||
memorystore@^1.6.2:
|
||||
version "1.6.2"
|
||||
resolved "https://registry.yarnpkg.com/memorystore/-/memorystore-1.6.2.tgz#66e7190d7d54885372c1aec3e256b92e3bf1d163"
|
||||
integrity sha512-HQM+cZB/kY1+jj57It22FsptJ3nuZRYxnwh3rWZEvDZO1zuzhIrX9uyFcjP9AhFQvM5WS6vZKtn3veohDH4S7w==
|
||||
dependencies:
|
||||
debug "3.1.0"
|
||||
lru-cache "^4.0.3"
|
||||
|
||||
meow@^3.7.0:
|
||||
version "3.7.0"
|
||||
resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb"
|
||||
|
Loading…
Reference in New Issue
Block a user