-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.js
101 lines (93 loc) · 2.73 KB
/
session.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'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: 'adonis-session',
/*
|--------------------------------------------------------------------------
| 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: ''
}
}