aboutsummaryrefslogtreecommitdiffstats
path: root/config/session.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/session.js')
-rw-r--r--config/session.js99
1 files changed, 99 insertions, 0 deletions
diff --git a/config/session.js b/config/session.js
new file mode 100644
index 0000000..f49b9b7
--- /dev/null
+++ b/config/session.js
@@ -0,0 +1,99 @@
1'use strict'
2
3const Env = use('Env')
4
5module.exports = {
6 /*
7 |--------------------------------------------------------------------------
8 | Session Driver
9 |--------------------------------------------------------------------------
10 |
11 | The session driver to be used for storing session values. It can be
12 | cookie, file or redis.
13 |
14 | For `redis` driver, make sure to install and register `@adonisjs/redis`
15 |
16 */
17 driver: Env.get('SESSION_DRIVER', 'cookie'),
18
19 /*
20 |--------------------------------------------------------------------------
21 | Cookie Name
22 |--------------------------------------------------------------------------
23 |
24 | The name of the cookie to be used for saving session id. Session ids
25 | are signed and encrypted.
26 |
27 */
28 cookieName: 'adonis-session',
29
30 /*
31 |--------------------------------------------------------------------------
32 | Clear session when browser closes
33 |--------------------------------------------------------------------------
34 |
35 | If this value is true, the session cookie will be temporary and will be
36 | removed when browser closes.
37 |
38 */
39 clearWithBrowser: true,
40
41 /*
42 |--------------------------------------------------------------------------
43 | Session age
44 |--------------------------------------------------------------------------
45 |
46 | This value is only used when `clearWithBrowser` is set to false. The
47 | age must be a valid https://npmjs.org/package/ms string or should
48 | be in milliseconds.
49 |
50 | Valid values are:
51 | '2h', '10d', '5y', '2.5 hrs'
52 |
53 */
54 age: '2h',
55
56 /*
57 |--------------------------------------------------------------------------
58 | Cookie options
59 |--------------------------------------------------------------------------
60 |
61 | Cookie options defines the options to be used for setting up session
62 | cookie
63 |
64 */
65 cookie: {
66 httpOnly: true,
67 path: '/',
68 sameSite: false
69 },
70
71 /*
72 |--------------------------------------------------------------------------
73 | Sessions location
74 |--------------------------------------------------------------------------
75 |
76 | If driver is set to file, we need to define the relative location from
77 | the temporary path or absolute url to any location.
78 |
79 */
80 file: {
81 location: 'sessions'
82 },
83
84 /*
85 |--------------------------------------------------------------------------
86 | Redis config
87 |--------------------------------------------------------------------------
88 |
89 | The configuration for the redis driver.
90 |
91 */
92 redis: {
93 host: '127.0.0.1',
94 port: 6379,
95 password: null,
96 db: 0,
97 keyPrefix: ''
98 }
99}