Skip to content

Session

Path: apps/api/src/config/session.ts

Redis is used as session store driver.

Redis is also used for other parts of system (cache, queue, rate limiter), they have separate connection settings, so they can be configured independently if needed.

Redis instance

URL

  • object-path: redis.url
  • dotenv var: SESSION_REDIS_URL | REDIS_URL
  • type: string
  • default: undefined

Host

  • object-path: redis.host
  • dotenv var: SESSION_REDIS_HOST | REDIS_HOST
  • type: string
  • default: 'localhost'

Port

  • object-path: redis.port
  • dotenv var: SESSION_REDIS_PORT | REDIS_PORT
  • type: number
  • default: 6379

Database

  • object-path: redis.db
  • dotenv var: SESSION_REDIS_DATABASE | REDIS_DATABASE
  • type: number
  • default: 0

Key prefix

  • object-path: redis.keyPrefix
  • dotenv var: SESSION_REDIS_PREFIX
  • type: string
  • default: 'it24:session:'
  • object-path: cookie.name
  • dotenv var: SESSION_COOKIE_NAME
  • type: string
  • default: it24_session

Lifetime of cookie. Defined as ms-formatted string, see ms for more information.

  • object-path: cookie.maxAge
  • dotenv var: SESSION_COOKIE_LIFETIME
  • default: '15m'
  • type: string
  • object-path: cookie.httpOnly
  • type: boolean
  • default: true
  • object-path: cookie.path
  • dotenv var: SESSION_COOKIE_PATH
  • type: string
  • default: '/api/admin/auth'
  • object-path: cookie.sameSite
  • dotenv var: SESSION_COOKIE_SAME_SITE
  • type: boolean | 'lax' | 'strict' | 'none'
  • default: 'lax'
  • object-path: cookie.httpOnly
  • dotenv var: SESSION_COOKIE_SECURE
  • type: boolean
  • default: false