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