diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/internal-server/config/session.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/internal-server/config/session.js')
-rw-r--r-- | src/internal-server/config/session.js | 97 |
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..3ce3cc4da --- /dev/null +++ b/src/internal-server/config/session.js | |||
@@ -0,0 +1,97 @@ | |||
1 | const Env = use('Env'); | ||
2 | |||
3 | module.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: 'localhost', | ||
92 | port: 6379, | ||
93 | password: null, | ||
94 | db: 0, | ||
95 | keyPrefix: '', | ||
96 | }, | ||
97 | }; | ||