diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/app.ts | 84 | ||||
-rw-r--r-- | config/auth.ts | 9 | ||||
-rw-r--r-- | config/bodyparser.ts | 2 | ||||
-rw-r--r-- | config/dashboard.ts | 2 | ||||
-rw-r--r-- | config/database.ts | 8 | ||||
-rw-r--r-- | config/drive.ts | 149 | ||||
-rw-r--r-- | config/hash.ts | 7 | ||||
-rw-r--r-- | config/logger.ts | 14 | ||||
-rw-r--r-- | config/mail.ts | 111 | ||||
-rw-r--r-- | config/session.ts | 4 |
10 files changed, 53 insertions, 337 deletions
diff --git a/config/app.ts b/config/app.ts index 5575bc1..278a6f8 100644 --- a/config/app.ts +++ b/config/app.ts | |||
@@ -7,8 +7,6 @@ | |||
7 | 7 | ||
8 | import proxyAddr from 'proxy-addr'; | 8 | import proxyAddr from 'proxy-addr'; |
9 | import env from '#start/env'; | 9 | import env from '#start/env'; |
10 | import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler'; | ||
11 | import { LoggerConfig } from '@adonisjs/core/types/logger'; | ||
12 | import { ValidatorConfig } from '@adonisjs/validator/types'; | 10 | import { ValidatorConfig } from '@adonisjs/validator/types'; |
13 | import { defineConfig } from '@adonisjs/core/http'; | 11 | import { defineConfig } from '@adonisjs/core/http'; |
14 | 12 | ||
@@ -27,12 +25,12 @@ import { defineConfig } from '@adonisjs/core/http'; | |||
27 | */ | 25 | */ |
28 | export const appKey: string = env.get('APP_KEY'); | 26 | export const appKey: string = env.get('APP_KEY'); |
29 | 27 | ||
30 | export const url: string = env.get('APP_URL'); | 28 | export const url = env.get('APP_URL'); |
31 | 29 | ||
32 | // TODO: this is parsed as string to be coherent with the previous version of the code we add (before migrating to AdonisJS 5) | 30 | // TODO: this is parsed as string to be coherent with the previous version of the code we add (before migrating to AdonisJS 5) |
33 | export const isRegistrationEnabled: string = env.get('IS_REGISTRATION_ENABLED'); | 31 | export const isRegistrationEnabled = env.get('IS_REGISTRATION_ENABLED'); |
34 | export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ'); | 32 | export const connectWithFranz = env.get('CONNECT_WITH_FRANZ'); |
35 | export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED'); | 33 | export const isCreationEnabled = env.get('IS_CREATION_ENABLED'); |
36 | export const jwtUsePEM: boolean = | 34 | export const jwtUsePEM: boolean = |
37 | env.get('JWT_USE_PEM', false) || | 35 | env.get('JWT_USE_PEM', false) || |
38 | (env.get('JWT_PUBLIC_KEY', '') !== '' && | 36 | (env.get('JWT_PUBLIC_KEY', '') !== '' && |
@@ -119,86 +117,14 @@ export const http = defineConfig({ | |||
119 | secure: false, | 117 | secure: false, |
120 | sameSite: false, | 118 | sameSite: false, |
121 | }, | 119 | }, |
122 | |||
123 | /* | ||
124 | |-------------------------------------------------------------------------- | ||
125 | | Force Content Negotiation | ||
126 | |-------------------------------------------------------------------------- | ||
127 | | | ||
128 | | The internals of the framework relies on the content negotiation to | ||
129 | | detect the best possible response type for a given HTTP request. | ||
130 | | | ||
131 | | However, it is a very common these days that API servers always wants to | ||
132 | | make response in JSON regardless of the existence of the `Accept` header. | ||
133 | | | ||
134 | | By setting `forceContentNegotiationTo = 'application/json'`, you negotiate | ||
135 | | with the server in advance to always return JSON without relying on the | ||
136 | | client to set the header explicitly. | ||
137 | | | ||
138 | */ | ||
139 | forceContentNegotiationTo: 'application/json', | ||
140 | }); | 120 | }); |
141 | 121 | ||
142 | /* | 122 | /* |
143 | |-------------------------------------------------------------------------- | 123 | |-------------------------------------------------------------------------- |
144 | | Logger | ||
145 | |-------------------------------------------------------------------------- | ||
146 | */ | ||
147 | export const logger: LoggerConfig = { | ||
148 | /* | ||
149 | |-------------------------------------------------------------------------- | ||
150 | | Application name | ||
151 | |-------------------------------------------------------------------------- | ||
152 | | | ||
153 | | The name of the application you want to add to the log. It is recommended | ||
154 | | to always have app name in every log line. | ||
155 | | | ||
156 | | The `APP_NAME` environment variable is automatically set by AdonisJS by | ||
157 | | reading the `name` property from the `package.json` file. | ||
158 | | | ||
159 | */ | ||
160 | name: env.get('APP_NAME', 'Ferdium-server'), | ||
161 | |||
162 | /* | ||
163 | |-------------------------------------------------------------------------- | ||
164 | | Toggle logger | ||
165 | |-------------------------------------------------------------------------- | ||
166 | | | ||
167 | | Enable or disable logger application wide | ||
168 | | | ||
169 | */ | ||
170 | enabled: true, | ||
171 | |||
172 | /* | ||
173 | |-------------------------------------------------------------------------- | ||
174 | | Logging level | ||
175 | |-------------------------------------------------------------------------- | ||
176 | | | ||
177 | | The level from which you want the logger to flush logs. It is recommended | ||
178 | | to make use of the environment variable, so that you can define log levels | ||
179 | | at deployment level and not code level. | ||
180 | | | ||
181 | */ | ||
182 | level: env.get('LOG_LEVEL', 'info'), | ||
183 | |||
184 | /* | ||
185 | |-------------------------------------------------------------------------- | ||
186 | | Pretty print | ||
187 | |-------------------------------------------------------------------------- | ||
188 | | | ||
189 | | It is highly advised NOT to use `prettyPrint` in production, since it | ||
190 | | can have huge impact on performance. | ||
191 | | | ||
192 | */ | ||
193 | prettyPrint: env.get('NODE_ENV') === 'development', | ||
194 | }; | ||
195 | |||
196 | /* | ||
197 | |-------------------------------------------------------------------------- | ||
198 | | Profiler | 124 | | Profiler |
199 | |-------------------------------------------------------------------------- | 125 | |-------------------------------------------------------------------------- |
200 | */ | 126 | */ |
201 | export const profiler: ProfilerConfig = { | 127 | export const profiler = { |
202 | /* | 128 | /* |
203 | |-------------------------------------------------------------------------- | 129 | |-------------------------------------------------------------------------- |
204 | | Toggle profiler | 130 | | Toggle profiler |
diff --git a/config/auth.ts b/config/auth.ts index a3fcc45..976aa19 100644 --- a/config/auth.ts +++ b/config/auth.ts | |||
@@ -79,7 +79,7 @@ const authConfig: AuthConfig = { | |||
79 | | that time. | 79 | | that time. |
80 | | | 80 | | |
81 | */ | 81 | */ |
82 | model: () => import('App/Models/User'), | 82 | model: () => import('#app/Models/User'), |
83 | }, | 83 | }, |
84 | }, | 84 | }, |
85 | /* | 85 | /* |
@@ -163,7 +163,7 @@ const authConfig: AuthConfig = { | |||
163 | | that time. | 163 | | that time. |
164 | | | 164 | | |
165 | */ | 165 | */ |
166 | model: () => import('App/Models/User'), | 166 | model: () => import('#app/Models/User'), |
167 | }, | 167 | }, |
168 | }, | 168 | }, |
169 | /* | 169 | /* |
@@ -226,7 +226,7 @@ const authConfig: AuthConfig = { | |||
226 | | that time. | 226 | | that time. |
227 | | | 227 | | |
228 | */ | 228 | */ |
229 | model: () => import('App/Models/User'), | 229 | model: () => import('#app/Models/User'), |
230 | }, | 230 | }, |
231 | }, | 231 | }, |
232 | jwt: { | 232 | jwt: { |
@@ -242,7 +242,6 @@ const authConfig: AuthConfig = { | |||
242 | persistJwt: true, | 242 | persistJwt: true, |
243 | // TODO: We should improve the following implementation as this is a security concern. | 243 | // TODO: We should improve the following implementation as this is a security concern. |
244 | // The following ts-expect-error is to set exp to undefined (JWT with no expiration) | 244 | // The following ts-expect-error is to set exp to undefined (JWT with no expiration) |
245 | // @ts-expect-error | ||
246 | jwtDefaultExpire: undefined, | 245 | jwtDefaultExpire: undefined, |
247 | refreshTokenDefaultExpire: '10d', | 246 | refreshTokenDefaultExpire: '10d', |
248 | tokenProvider: { | 247 | tokenProvider: { |
@@ -254,7 +253,7 @@ const authConfig: AuthConfig = { | |||
254 | driver: 'lucid', | 253 | driver: 'lucid', |
255 | identifierKey: 'id', | 254 | identifierKey: 'id', |
256 | uids: [], | 255 | uids: [], |
257 | model: () => import('App/Models/User'), | 256 | model: () => import('#app/Models/User'), |
258 | }, | 257 | }, |
259 | }, | 258 | }, |
260 | }, | 259 | }, |
diff --git a/config/bodyparser.ts b/config/bodyparser.ts index b8e6ed6..63fc03c 100644 --- a/config/bodyparser.ts +++ b/config/bodyparser.ts | |||
@@ -5,7 +5,6 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import { BodyParserConfig } from '@adonisjs/core/bodyparser'; | ||
9 | import { defineConfig } from '@adonisjs/core/bodyparser'; | 8 | import { defineConfig } from '@adonisjs/core/bodyparser'; |
10 | 9 | ||
11 | const bodyParserConfig = defineConfig({ | 10 | const bodyParserConfig = defineConfig({ |
@@ -83,7 +82,6 @@ const bodyParserConfig = defineConfig({ | |||
83 | raw: { | 82 | raw: { |
84 | encoding: 'utf8', | 83 | encoding: 'utf8', |
85 | limit: '1mb', | 84 | limit: '1mb', |
86 | queryString: {}, | ||
87 | types: ['text/*'], | 85 | types: ['text/*'], |
88 | }, | 86 | }, |
89 | 87 | ||
diff --git a/config/dashboard.ts b/config/dashboard.ts index bbf7a71..5d3afbb 100644 --- a/config/dashboard.ts +++ b/config/dashboard.ts | |||
@@ -2,4 +2,4 @@ import env from '#start/env'; | |||
2 | 2 | ||
3 | export const enabled: boolean = env.get('IS_DASHBOARD_ENABLED') !== 'false'; | 3 | export const enabled: boolean = env.get('IS_DASHBOARD_ENABLED') !== 'false'; |
4 | 4 | ||
5 | export const mailFrom: string = env.get('MAIL_SENDER'); | 5 | export const mailFrom: string = env.get('MAIL_SENDER')!; |
diff --git a/config/database.ts b/config/database.ts index 7e3774d..d2fabe1 100644 --- a/config/database.ts +++ b/config/database.ts | |||
@@ -7,7 +7,6 @@ | |||
7 | 7 | ||
8 | import path from 'node:path'; | 8 | import path from 'node:path'; |
9 | import env from '#start/env'; | 9 | import env from '#start/env'; |
10 | import { DatabaseConfig } from '@adonisjs/lucid/database'; | ||
11 | import { defineConfig } from '@adonisjs/lucid'; | 10 | import { defineConfig } from '@adonisjs/lucid'; |
12 | 11 | ||
13 | const databaseConfig = defineConfig({ | 12 | const databaseConfig = defineConfig({ |
@@ -53,7 +52,6 @@ const databaseConfig = defineConfig({ | |||
53 | }, | 52 | }, |
54 | useNullAsDefault: true, | 53 | useNullAsDefault: true, |
55 | healthCheck: false, | 54 | healthCheck: false, |
56 | debug: env.get('DB_DEBUG', false), | ||
57 | }, | 55 | }, |
58 | 56 | ||
59 | /* | 57 | /* |
@@ -71,7 +69,7 @@ const databaseConfig = defineConfig({ | |||
71 | client: 'mysql', | 69 | client: 'mysql', |
72 | connection: { | 70 | connection: { |
73 | host: env.get('DB_HOST', 'localhost'), | 71 | host: env.get('DB_HOST', 'localhost'), |
74 | port: env.get('DB_PORT', ''), | 72 | port: Number(env.get('DB_PORT')), |
75 | user: env.get('DB_USER', 'root'), | 73 | user: env.get('DB_USER', 'root'), |
76 | password: env.get('DB_PASSWORD', ''), | 74 | password: env.get('DB_PASSWORD', ''), |
77 | database: env.get('DB_DATABASE', 'ferdium'), | 75 | database: env.get('DB_DATABASE', 'ferdium'), |
@@ -80,7 +78,6 @@ const databaseConfig = defineConfig({ | |||
80 | naturalSort: true, | 78 | naturalSort: true, |
81 | }, | 79 | }, |
82 | healthCheck: false, | 80 | healthCheck: false, |
83 | debug: env.get('DB_DEBUG', false), | ||
84 | }, | 81 | }, |
85 | 82 | ||
86 | /* | 83 | /* |
@@ -98,7 +95,7 @@ const databaseConfig = defineConfig({ | |||
98 | client: 'pg', | 95 | client: 'pg', |
99 | connection: { | 96 | connection: { |
100 | host: env.get('DB_HOST', 'localhost'), | 97 | host: env.get('DB_HOST', 'localhost'), |
101 | port: env.get('DB_PORT', ''), | 98 | port: Number(env.get('DB_PORT')), |
102 | user: env.get('DB_USER', 'root'), | 99 | user: env.get('DB_USER', 'root'), |
103 | password: env.get('DB_PASSWORD', ''), | 100 | password: env.get('DB_PASSWORD', ''), |
104 | database: env.get('DB_DATABASE', 'ferdium'), | 101 | database: env.get('DB_DATABASE', 'ferdium'), |
@@ -113,7 +110,6 @@ const databaseConfig = defineConfig({ | |||
113 | naturalSort: true, | 110 | naturalSort: true, |
114 | }, | 111 | }, |
115 | healthCheck: false, | 112 | healthCheck: false, |
116 | debug: env.get('DB_DEBUG', false), | ||
117 | }, | 113 | }, |
118 | }, | 114 | }, |
119 | }); | 115 | }); |
diff --git a/config/drive.ts b/config/drive.ts deleted file mode 100644 index 98cc905..0000000 --- a/config/drive.ts +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /** | ||
2 | * Config source: https://git.io/JBt3o | ||
3 | * | ||
4 | * Feel free to let us know via PR, if you find something broken in this config | ||
5 | * file. | ||
6 | */ | ||
7 | |||
8 | import env from '#start/env'; | ||
9 | import { driveConfig } from '@adonisjs/core/build/config'; | ||
10 | import { app } from '@adonisjs/core/services/app'; | ||
11 | |||
12 | /* | ||
13 | |-------------------------------------------------------------------------- | ||
14 | | Drive Config | ||
15 | |-------------------------------------------------------------------------- | ||
16 | | | ||
17 | | The `DriveConfig` relies on the `DisksList` interface which is | ||
18 | | defined inside the `contracts` directory. | ||
19 | | | ||
20 | */ | ||
21 | export default driveConfig({ | ||
22 | /* | ||
23 | |-------------------------------------------------------------------------- | ||
24 | | Default disk | ||
25 | |-------------------------------------------------------------------------- | ||
26 | | | ||
27 | | The default disk to use for managing file uploads. The value is driven by | ||
28 | | the `DRIVE_DISK` environment variable. | ||
29 | | | ||
30 | */ | ||
31 | disk: env.get('DRIVE_DISK', 'local'), | ||
32 | |||
33 | disks: { | ||
34 | /* | ||
35 | |-------------------------------------------------------------------------- | ||
36 | | Local | ||
37 | |-------------------------------------------------------------------------- | ||
38 | | | ||
39 | | Uses the local file system to manage files. Make sure to turn off serving | ||
40 | | files when not using this disk. | ||
41 | | | ||
42 | */ | ||
43 | local: { | ||
44 | driver: 'local', | ||
45 | visibility: 'public', | ||
46 | |||
47 | /* | ||
48 | |-------------------------------------------------------------------------- | ||
49 | | Storage root - Local driver only | ||
50 | |-------------------------------------------------------------------------- | ||
51 | | | ||
52 | | Define an absolute path to the storage directory from where to read the | ||
53 | | files. | ||
54 | | | ||
55 | */ | ||
56 | root: app.tmpPath('uploads'), | ||
57 | |||
58 | /* | ||
59 | |-------------------------------------------------------------------------- | ||
60 | | Serve files - Local driver only | ||
61 | |-------------------------------------------------------------------------- | ||
62 | | | ||
63 | | When this is set to true, AdonisJS will configure a files server to serve | ||
64 | | files from the disk root. This is done to mimic the behavior of cloud | ||
65 | | storage services that has inbuilt capabilities to serve files. | ||
66 | | | ||
67 | */ | ||
68 | serveFiles: true, | ||
69 | |||
70 | /* | ||
71 | |-------------------------------------------------------------------------- | ||
72 | | Base path - Local driver only | ||
73 | |-------------------------------------------------------------------------- | ||
74 | | | ||
75 | | Base path is always required when "serveFiles = true". Also make sure | ||
76 | | the `basePath` is unique across all the disks using "local" driver and | ||
77 | | you are not registering routes with this prefix. | ||
78 | | | ||
79 | */ | ||
80 | basePath: '/uploads', | ||
81 | }, | ||
82 | |||
83 | /* | ||
84 | |-------------------------------------------------------------------------- | ||
85 | | S3 Driver | ||
86 | |-------------------------------------------------------------------------- | ||
87 | | | ||
88 | | Uses the S3 cloud storage to manage files. Make sure to install the s3 | ||
89 | | drive separately when using it. | ||
90 | | | ||
91 | |************************************************************************** | ||
92 | | npm i @adonisjs/drive-s3 | ||
93 | |************************************************************************** | ||
94 | | | ||
95 | */ | ||
96 | // s3: { | ||
97 | // driver: 's3', | ||
98 | // visibility: 'public', | ||
99 | // key: Env.get('S3_KEY'), | ||
100 | // secret: Env.get('S3_SECRET'), | ||
101 | // region: Env.get('S3_REGION'), | ||
102 | // bucket: Env.get('S3_BUCKET'), | ||
103 | // endpoint: Env.get('S3_ENDPOINT'), | ||
104 | // | ||
105 | // // For minio to work | ||
106 | // // forcePathStyle: true, | ||
107 | // }, | ||
108 | |||
109 | /* | ||
110 | |-------------------------------------------------------------------------- | ||
111 | | GCS Driver | ||
112 | |-------------------------------------------------------------------------- | ||
113 | | | ||
114 | | Uses the Google cloud storage to manage files. Make sure to install the GCS | ||
115 | | drive separately when using it. | ||
116 | | | ||
117 | |************************************************************************** | ||
118 | | npm i @adonisjs/drive-gcs | ||
119 | |************************************************************************** | ||
120 | | | ||
121 | */ | ||
122 | // gcs: { | ||
123 | // driver: 'gcs', | ||
124 | // visibility: 'public', | ||
125 | // keyFilename: Env.get('GCS_KEY_FILENAME'), | ||
126 | // bucket: Env.get('GCS_BUCKET'), | ||
127 | |||
128 | /* | ||
129 | |-------------------------------------------------------------------------- | ||
130 | | Uniform ACL - Google cloud storage only | ||
131 | |-------------------------------------------------------------------------- | ||
132 | | | ||
133 | | When using the Uniform ACL on the bucket, the "visibility" option is | ||
134 | | ignored. Since, the files ACL is managed by the google bucket policies | ||
135 | | directly. | ||
136 | | | ||
137 | |************************************************************************** | ||
138 | | Learn more: https://cloud.google.com/storage/docs/uniform-bucket-level-access | ||
139 | |************************************************************************** | ||
140 | | | ||
141 | | The following option just informs drive whether your bucket is using uniform | ||
142 | | ACL or not. The actual setting needs to be toggled within the Google cloud | ||
143 | | console. | ||
144 | | | ||
145 | */ | ||
146 | // usingUniformAcl: false, | ||
147 | // }, | ||
148 | }, | ||
149 | }); | ||
diff --git a/config/hash.ts b/config/hash.ts index 38c8784..891833c 100644 --- a/config/hash.ts +++ b/config/hash.ts | |||
@@ -6,8 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | import env from '#start/env'; | 8 | import env from '#start/env'; |
9 | import { defineConfig } from '@adonisjs/core/hash'; | 9 | import { defineConfig, drivers } from '@adonisjs/core/hash'; |
10 | import { drivers } from '@adonisjs/core/hash'; | ||
11 | 10 | ||
12 | /* | 11 | /* |
13 | |-------------------------------------------------------------------------- | 12 | |-------------------------------------------------------------------------- |
@@ -84,7 +83,3 @@ export default defineConfig({ | |||
84 | }, | 83 | }, |
85 | }, | 84 | }, |
86 | }); | 85 | }); |
87 | |||
88 | declare module '@adonisjs/core/types' { | ||
89 | export interface HashersList extends InferHashers<typeof hashConfig> {} | ||
90 | } | ||
diff --git a/config/logger.ts b/config/logger.ts new file mode 100644 index 0000000..a9078b6 --- /dev/null +++ b/config/logger.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import env from '#start/env'; | ||
2 | import { defineConfig } from '@adonisjs/core/logger'; | ||
3 | |||
4 | export default defineConfig({ | ||
5 | default: 'app', | ||
6 | |||
7 | loggers: { | ||
8 | app: { | ||
9 | enabled: true, | ||
10 | name: env.get('APP_NAME', 'Ferdium-server'), | ||
11 | level: env.get('LOG_LEVEL', 'info'), | ||
12 | }, | ||
13 | }, | ||
14 | }); | ||
diff --git a/config/mail.ts b/config/mail.ts index ac67231..dbe4bdf 100644 --- a/config/mail.ts +++ b/config/mail.ts | |||
@@ -1,118 +1,55 @@ | |||
1 | /** | ||
2 | * Config source: https://git.io/JvgAf | ||
3 | * | ||
4 | * Feel free to let us know via PR, if you find something broken in this contract | ||
5 | * file. | ||
6 | */ | ||
7 | |||
8 | import env from '#start/env'; | 1 | import env from '#start/env'; |
9 | import { defineConfig } from '@adonisjs/mail'; | 2 | import { defineConfig, transports } from '@adonisjs/mail'; |
10 | 3 | ||
11 | export default defineConfig({ | 4 | const mailConfig = defineConfig({ |
12 | /* | 5 | default: 'smtp', |
13 | |-------------------------------------------------------------------------- | ||
14 | | Default mailer | ||
15 | |-------------------------------------------------------------------------- | ||
16 | | | ||
17 | | The following mailer will be used to send emails, when you don't specify | ||
18 | | a mailer | ||
19 | | | ||
20 | */ | ||
21 | mailer: env.get('MAIL_CONNECTION', 'smtp'), | ||
22 | 6 | ||
23 | /* | 7 | /** |
24 | |-------------------------------------------------------------------------- | 8 | * The mailers object can be used to configure multiple mailers |
25 | | Mailers | 9 | * each using a different transport or same transport with different |
26 | |-------------------------------------------------------------------------- | 10 | * options. |
27 | | | 11 | */ |
28 | | You can define or more mailers to send emails from your application. A | ||
29 | | single `driver` can be used to define multiple mailers with different | ||
30 | | config. | ||
31 | | | ||
32 | | For example: Postmark driver can be used to have different mailers for | ||
33 | | sending transactional and promotional emails | ||
34 | | | ||
35 | */ | ||
36 | mailers: { | 12 | mailers: { |
37 | /* | 13 | smtp: transports.smtp({ |
38 | |-------------------------------------------------------------------------- | ||
39 | | Smtp | ||
40 | |-------------------------------------------------------------------------- | ||
41 | | | ||
42 | | Uses SMTP protocol for sending email | ||
43 | | | ||
44 | */ | ||
45 | smtp: drivers.smtp({ | ||
46 | name: env.get('APP_URL'), | ||
47 | port: env.get('SMTP_PORT', '2525'), | 14 | port: env.get('SMTP_PORT', '2525'), |
48 | host: env.get('SMTP_HOST', 'localhost'), | 15 | host: env.get('SMTP_HOST', 'localhost'), |
49 | secure: JSON.parse(env.get('MAIL_SSL', 'false')), | 16 | secure: JSON.parse(env.get('MAIL_SSL', 'false')), |
50 | requireTLS: JSON.parse(env.get('MAIL_REQUIRE_TLS', 'false')), | 17 | requireTLS: JSON.parse(env.get('MAIL_REQUIRE_TLS', 'false')), |
51 | auth: { | 18 | auth: { |
52 | user: env.get('MAIL_USERNAME'), | 19 | user: env.get('MAIL_USERNAME')!, |
53 | pass: env.get('MAIL_PASSWORD'), | 20 | pass: env.get('MAIL_PASSWORD')!, |
54 | type: 'login', | 21 | type: 'login', |
55 | }, | 22 | }, |
56 | maxConnections: 5, | 23 | maxConnections: 5, |
57 | maxMessages: 100, | 24 | maxMessages: 100, |
58 | rateLimit: 10, | ||
59 | }), | 25 | }), |
60 | 26 | ||
61 | /* | 27 | ses: transports.ses({ |
62 | |-------------------------------------------------------------------------- | ||
63 | | SES | ||
64 | |-------------------------------------------------------------------------- | ||
65 | | | ||
66 | | Uses Amazon SES for sending emails. You will have to install the aws-sdk | ||
67 | | when using this driver. | ||
68 | | | ||
69 | | ``` | ||
70 | | npm i aws-sdk | ||
71 | | ``` | ||
72 | | | ||
73 | */ | ||
74 | ses: drivers.ses({ | ||
75 | apiVersion: '2010-12-01', | 28 | apiVersion: '2010-12-01', |
76 | key: env.get('SES_ACCESS_KEY'), | 29 | credentials: { |
77 | secret: env.get('SES_ACCESS_SECRET'), | 30 | accessKeyId: env.get('SES_ACCESS_KEY')!, |
78 | region: env.get('SES_REGION'), | 31 | secretAccessKey: env.get('SES_ACCESS_SECRET')!, |
79 | sslEnabled: true, | 32 | }, |
33 | region: process.env.SES_REGION!, | ||
80 | sendingRate: 10, | 34 | sendingRate: 10, |
81 | maxConnections: 5, | 35 | maxConnections: 5, |
82 | }), | 36 | }), |
83 | 37 | ||
84 | /* | 38 | mailgun: transports.mailgun({ |
85 | |-------------------------------------------------------------------------- | ||
86 | | Mailgun | ||
87 | |-------------------------------------------------------------------------- | ||
88 | | | ||
89 | | Uses Mailgun service for sending emails. | ||
90 | | | ||
91 | | If you are using an EU domain. Ensure to change the baseUrl to hit the | ||
92 | | europe endpoint (https://api.eu.mailgun.net/v3). | ||
93 | | | ||
94 | */ | ||
95 | mailgun: drivers.mailgun({ | ||
96 | baseUrl: 'https://api.mailgun.net/v3', | 39 | baseUrl: 'https://api.mailgun.net/v3', |
97 | key: env.get('MAILGUN_API_KEY'), | 40 | key: env.get('MAILGUN_API_KEY')!, |
98 | domain: env.get('MAILGUN_DOMAIN'), | 41 | domain: env.get('MAILGUN_DOMAIN')!, |
99 | }), | 42 | }), |
100 | 43 | ||
101 | /* | 44 | sparkpost: transports.sparkpost({ |
102 | |-------------------------------------------------------------------------- | ||
103 | | SparkPost | ||
104 | |-------------------------------------------------------------------------- | ||
105 | | | ||
106 | | Uses Sparkpost service for sending emails. | ||
107 | | | ||
108 | */ | ||
109 | sparkpost: drivers.sparkpost({ | ||
110 | baseUrl: 'https://api.sparkpost.com/api/v1', | 45 | baseUrl: 'https://api.sparkpost.com/api/v1', |
111 | key: env.get('SPARKPOST_API_KEY'), | 46 | key: env.get('SPARKPOST_API_KEY')!, |
112 | }), | 47 | }), |
113 | }, | 48 | }, |
114 | }); | 49 | }); |
115 | 50 | ||
51 | export default mailConfig; | ||
52 | |||
116 | declare module '@adonisjs/mail/types' { | 53 | declare module '@adonisjs/mail/types' { |
117 | export interface MailersList extends InferMailers<typeof mailConfig> {} | 54 | export interface MailersList extends InferMailers<typeof mailConfig> {} |
118 | } | 55 | } |
diff --git a/config/session.ts b/config/session.ts index d3f5642..3f193dd 100644 --- a/config/session.ts +++ b/config/session.ts | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | import env from '#start/env'; | 8 | import env from '#start/env'; |
9 | import { app } from '@adonisjs/core/services/app'; | 9 | import app from '@adonisjs/core/services/app'; |
10 | import { defineConfig } from '@adonisjs/session'; | 10 | import { defineConfig } from '@adonisjs/session'; |
11 | 11 | ||
12 | export default defineConfig({ | 12 | export default defineConfig({ |
@@ -36,7 +36,7 @@ export default defineConfig({ | |||
36 | | Note: Switching drivers will make existing sessions invalid. | 36 | | Note: Switching drivers will make existing sessions invalid. |
37 | | | 37 | | |
38 | */ | 38 | */ |
39 | driver: env.get('SESSION_DRIVER', 'cookie'), | 39 | store: env.get('SESSION_DRIVER', 'cookie'), |
40 | 40 | ||
41 | /* | 41 | /* |
42 | |-------------------------------------------------------------------------- | 42 | |-------------------------------------------------------------------------- |