This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
seepur/config/session.js

102 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2020-01-14 01:57:43 +00:00
'use strict'
/** @type {import('@adonisjs/framework/src/Env')} */
const Env = use('Env')
module.exports = {
/*
|--------------------------------------------------------------------------
| Session Driver
|--------------------------------------------------------------------------
|
| The session driver to be used for storing session values. It can be
| cookie, file or redis.
|
| For `redis` driver, make sure to install and register `@adonisjs/redis`
|
*/
driver: Env.get('SESSION_DRIVER', 'cookie'),
/*
|--------------------------------------------------------------------------
| Cookie Name
|--------------------------------------------------------------------------
|
| The name of the cookie to be used for saving session id. Session ids
| are signed and encrypted.
|
*/
cookieName: 'seepur-session',
2020-01-14 01:57:43 +00:00
/*
|--------------------------------------------------------------------------
| Clear session when browser closes
|--------------------------------------------------------------------------
|
| If this value is true, the session cookie will be temporary and will be
| removed when browser closes.
|
*/
clearWithBrowser: true,
/*
|--------------------------------------------------------------------------
| Session age
|--------------------------------------------------------------------------
|
| This value is only used when `clearWithBrowser` is set to false. The
| age must be a valid https://npmjs.org/package/ms string or should
| be in milliseconds.
|
| Valid values are:
| '2h', '10d', '5y', '2.5 hrs'
|
*/
age: '2h',
/*
|--------------------------------------------------------------------------
| Cookie options
|--------------------------------------------------------------------------
|
| Cookie options defines the options to be used for setting up session
| cookie
|
*/
cookie: {
httpOnly: true,
sameSite: false,
path: '/'
},
/*
|--------------------------------------------------------------------------
| Sessions location
|--------------------------------------------------------------------------
|
| If driver is set to file, we need to define the relative location from
| the temporary path or absolute url to any location.
|
*/
file: {
location: 'sessions'
},
/*
|--------------------------------------------------------------------------
| Redis config
|--------------------------------------------------------------------------
|
| The configuration for the redis driver. By default we reference it from
| the redis file. But you are free to define an object here too.
|
*/
redis: {
host: '127.0.0.1',
port: 6379,
password: null,
db: 0,
keyPrefix: ''
}
}