sails.config.session

What is this?

Sails session integration leans heavily on the great work already done by Express, but also unifies Socket.io with the Connect session store.

Description

Sails session integration leans heavily on the great work already done by Express, but also unifies Socket.io with the Connect session store. It uses Connect’s cookie parser to normalize configuration differences between Express and Socket.io and hooks into Sails’ middleware interpreter to allow you to access and auto-save to req.session with Socket.io the same way you would with Express.

secret

Session secret is automatically generated when your new app is created. Replace at your own risk in production— you will invalidate the cookies of your users, forcing them to log in again.

Shared Redis session store

In production, uncomment the following line to set up a shared redis session store that can be shared across multiple Sails.js servers.

  1. adapter: 'redis',

The following values are optional, if no options are set a redis instance running on localhost is expected. Read more about options at: https://github.com/visionmedia/connect-redis

  1. host: 'localhost',
  2. port: 6379,
  3. ttl: <redis session TTL in seconds>,
  4. db: 0,
  5. pass: <redis auth password>
  6. prefix: 'sess:'

Uncomment the following lines to use your Mongo adapter as a session store

  1. adapter: 'mongo',
  2. host: 'localhost',
  3. port: 27017,
  4. db: 'sails',
  5. collection: 'sessions',

Optional Values:

  1. // Note: url will override other connection settings
  2. // url: 'mongodb://user:pass@host:port/database/collection',
  3. username: '',
  4. password: '',
  5. auto_reconnect: false,
  6. ssl: false,
  7. stringify: true