Skip to content

Commit

Permalink
Use memorystore (#55)
Browse files Browse the repository at this point in the history
* replace session-memory-store with memorystore package

* apply npm audit fix

* remove login apps with expired key

* use node:10-alpine image
  • Loading branch information
lipp committed Aug 8, 2018
1 parent 5db95d5 commit 74cf057
Show file tree
Hide file tree
Showing 5 changed files with 1,422 additions and 1,735 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:7-alpine
FROM node:10-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
Expand Down
2 changes: 1 addition & 1 deletion example/nextjs/pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Login = ({profile, origin}) => {
const redirect = encodeURIComponent(origin + '/')
return (
<div className='section'>
{ !profile && ['Twitter', 'Google', 'GitHub', 'Reddit', 'Facebook', 'LinkedIn', 'Instagram'].map(service => (
{ !profile && ['Google', 'GitHub', 'Reddit', 'LinkedIn', 'Instagram'].map(service => (
<LoginWith key={service} service={service} redirect={redirect} />
))
}
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const express = require('express')
const passport = require('passport')
const cookieParser = require('cookie-parser')
const expressSession = require('express-session')
const MemoryStore = require('session-memory-store')(expressSession)
const MemoryStore = require('memorystore')(expressSession)

const opts = require('./src/opts')(process.argv, process.env)

Expand Down Expand Up @@ -37,7 +37,9 @@ app.use(expressSession({
secret: opts.sessionSecret,
resave: false,
saveUninitialized: false,
store: new MemoryStore()
store: new MemoryStore({
checkPeriod: 1000 * 60 * 3 // 3 minutes
})
}))
app.use(passport.initialize())

Expand Down
Loading

0 comments on commit 74cf057

Please sign in to comment.