Skip to content

Commit

Permalink
Merge pull request #1200 from mcneilco/revert-1197-ACAS-828
Browse files Browse the repository at this point in the history
Revert "ACAS-828 Use postgres for session management"
  • Loading branch information
brianbolt authored Jan 15, 2025
2 parents 80e0a66 + 090e8fe commit 4409c26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
12 changes: 4 additions & 8 deletions app_template.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ startApp = ->
logger = require('morgan')
methodOverride = require('method-override')
session = require('express-session')
PostgresqlStore = require('connect-pg-simple')(session)
MemoryStore = require('memorystore')(session)
bodyParser = require('body-parser')
errorHandler = require('errorhandler')
cookieParser = require('cookie-parser')
Expand Down Expand Up @@ -78,9 +78,7 @@ startApp = ->
console.error("NOT USING SSO configs! config.all.server.security.saml.use is set true but CustomerSpecificServerFunction 'ssoLoginStrategy' is not defined.")

loginRoutes = require './routes/loginRoutes'
sessionStore = new PostgresqlStore(
conString: "postgres://#{config.all.server.database.username}:#{config.all.server.database.password}@#{config.all.server.database.host}:#{config.all.server.database.port}/#{config.all.server.database.name}"
)
sessionStore = new MemoryStore();
global.app = express()
app.set 'port', config.all.client.port
app.set 'listenHost', config.all.client.listenHost
Expand Down Expand Up @@ -119,14 +117,12 @@ startApp = ->

# added for login support
app.use cookieParser()
console.log "Session timeout set to #{config.all.server.sessionTimeOutMinutes} minutes"
sessionTimeOutMilliseconds = config.all.server.sessionTimeOutMinutes * 60 * 1000
app.use session
secret: 'acas needs login'
cookie: maxAge: sessionTimeOutMilliseconds
cookie: maxAge: 365 * 24 * 60 * 60 * 1000
resave: true
saveUninitialized: true,
store: sessionStore
store: sessionStore # MemoryStore is used automatically if no "store" field is set, but we need a handle on the sessionStore object for Socket.IO, so we'll manually create the store so we have a handle on the object

app.use flash()
app.use passport.initialize()
Expand Down
2 changes: 0 additions & 2 deletions conf/config.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,6 @@ client.cmpdreg.serverSettings.liveDesign.url=http://localhost:8010/ld-chem

client.cmpdreg.serverSettings.maxStandardizationDisplay=20000

# Sets cookie maxAge to 1440 minutes = 24 hours
server.sessionTimeOutMinutes=1440

# About configs
client.about.acas.version=0.0.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"less": "^3.12.2",
"lodash": "^4.17.20",
"marked": "4.0.10",
"connect-pg-simple": "10.0.0",
"memorystore": "1.6.4",
"method-override": "^3.0.0",
"mocha": "8.2.1",
"mochawesome": "^6.2.1",
Expand Down

0 comments on commit 4409c26

Please sign in to comment.