diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/app.ts | 33 | ||||
-rw-r--r-- | config/auth.ts | 18 | ||||
-rw-r--r-- | config/bodyparser.ts | 8 | ||||
-rw-r--r-- | config/cors.ts | 6 | ||||
-rw-r--r-- | config/dashboard.ts | 6 | ||||
-rw-r--r-- | config/database.ts | 16 | ||||
-rw-r--r-- | config/drive.ts | 8 | ||||
-rw-r--r-- | config/hash.ts | 8 | ||||
-rw-r--r-- | config/mail.ts | 6 | ||||
-rw-r--r-- | config/session.ts | 8 | ||||
-rw-r--r-- | config/shield.ts | 13 | ||||
-rw-r--r-- | config/static.ts | 6 |
12 files changed, 72 insertions, 64 deletions
diff --git a/config/app.ts b/config/app.ts index 135f20f..5575bc1 100644 --- a/config/app.ts +++ b/config/app.ts | |||
@@ -5,12 +5,12 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 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' | 10 | import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler'; |
11 | import { LoggerConfig } from '@adonisjs/core/types/logger' | 11 | import { LoggerConfig } from '@adonisjs/core/types/logger'; |
12 | import { ValidatorConfig } from '@adonisjs/validator/types' | 12 | import { ValidatorConfig } from '@adonisjs/validator/types'; |
13 | import { defineConfig } from '@adonisjs/core/http' | 13 | import { defineConfig } from '@adonisjs/core/http'; |
14 | 14 | ||
15 | /* | 15 | /* |
16 | |-------------------------------------------------------------------------- | 16 | |-------------------------------------------------------------------------- |
@@ -25,17 +25,18 @@ import { defineConfig } from '@adonisjs/core/http' | |||
25 | | be decrypted. | 25 | | be decrypted. |
26 | | | 26 | | |
27 | */ | 27 | */ |
28 | export const appKey: string = env.get('APP_KEY') | 28 | export const appKey: string = env.get('APP_KEY'); |
29 | 29 | ||
30 | export const url: string = env.get('APP_URL') | 30 | export const url: string = env.get('APP_URL'); |
31 | 31 | ||
32 | // TODO: this is parsed as string to be coherent with the previous version of the code we add (before migrating to AdonisJS 5) | 32 | // 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') | 33 | export const isRegistrationEnabled: string = env.get('IS_REGISTRATION_ENABLED'); |
34 | export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ') | 34 | export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ'); |
35 | export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED') | 35 | export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED'); |
36 | export const jwtUsePEM: boolean = | 36 | export const jwtUsePEM: boolean = |
37 | env.get('JWT_USE_PEM', false) || | 37 | env.get('JWT_USE_PEM', false) || |
38 | (env.get('JWT_PUBLIC_KEY', '') !== '' && env.get('JWT_PRIVATE_KEY', '') !== '') | 38 | (env.get('JWT_PUBLIC_KEY', '') !== '' && |
39 | env.get('JWT_PRIVATE_KEY', '') !== ''); | ||
39 | /* | 40 | /* |
40 | |-------------------------------------------------------------------------- | 41 | |-------------------------------------------------------------------------- |
41 | | Http server configuration | 42 | | Http server configuration |
@@ -136,7 +137,7 @@ export const http = defineConfig({ | |||
136 | | | 137 | | |
137 | */ | 138 | */ |
138 | forceContentNegotiationTo: 'application/json', | 139 | forceContentNegotiationTo: 'application/json', |
139 | }) | 140 | }); |
140 | 141 | ||
141 | /* | 142 | /* |
142 | |-------------------------------------------------------------------------- | 143 | |-------------------------------------------------------------------------- |
@@ -190,7 +191,7 @@ export const logger: LoggerConfig = { | |||
190 | | | 191 | | |
191 | */ | 192 | */ |
192 | prettyPrint: env.get('NODE_ENV') === 'development', | 193 | prettyPrint: env.get('NODE_ENV') === 'development', |
193 | } | 194 | }; |
194 | 195 | ||
195 | /* | 196 | /* |
196 | |-------------------------------------------------------------------------- | 197 | |-------------------------------------------------------------------------- |
@@ -229,7 +230,7 @@ export const profiler: ProfilerConfig = { | |||
229 | | | 230 | | |
230 | */ | 231 | */ |
231 | whitelist: [], | 232 | whitelist: [], |
232 | } | 233 | }; |
233 | 234 | ||
234 | /* | 235 | /* |
235 | |-------------------------------------------------------------------------- | 236 | |-------------------------------------------------------------------------- |
@@ -240,4 +241,4 @@ export const profiler: ProfilerConfig = { | |||
240 | | to the default config https://git.io/JT0WE | 241 | | to the default config https://git.io/JT0WE |
241 | | | 242 | | |
242 | */ | 243 | */ |
243 | export const validator: ValidatorConfig = {} | 244 | export const validator: ValidatorConfig = {}; |
diff --git a/config/auth.ts b/config/auth.ts index f43bbdb..a3fcc45 100644 --- a/config/auth.ts +++ b/config/auth.ts | |||
@@ -5,9 +5,9 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import { AuthConfig } from '@ioc:Adonis/Addons/Auth' | 8 | import { AuthConfig } from '@ioc:Adonis/Addons/Auth'; |
9 | import env from '#start/env' | 9 | import env from '#start/env'; |
10 | import { appKey, jwtUsePEM } from './app.js' | 10 | import { appKey, jwtUsePEM } from './app.js'; |
11 | 11 | ||
12 | /* | 12 | /* |
13 | |-------------------------------------------------------------------------- | 13 | |-------------------------------------------------------------------------- |
@@ -233,8 +233,12 @@ const authConfig: AuthConfig = { | |||
233 | driver: 'jwt', | 233 | driver: 'jwt', |
234 | secret: jwtUsePEM ? undefined : appKey, | 234 | secret: jwtUsePEM ? undefined : appKey, |
235 | algorithmJwt: jwtUsePEM ? undefined : 'HS256', | 235 | algorithmJwt: jwtUsePEM ? undefined : 'HS256', |
236 | publicKey: jwtUsePEM ? env.get('JWT_PUBLIC_KEY', '').replaceAll('\\n', '\n') : undefined, | 236 | publicKey: jwtUsePEM |
237 | privateKey: jwtUsePEM ? env.get('JWT_PRIVATE_KEY', '').replaceAll('\\n', '\n') : undefined, | 237 | ? env.get('JWT_PUBLIC_KEY', '').replaceAll('\\n', '\n') |
238 | : undefined, | ||
239 | privateKey: jwtUsePEM | ||
240 | ? env.get('JWT_PRIVATE_KEY', '').replaceAll('\\n', '\n') | ||
241 | : undefined, | ||
238 | persistJwt: true, | 242 | persistJwt: true, |
239 | // 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. |
240 | // 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) |
@@ -254,6 +258,6 @@ const authConfig: AuthConfig = { | |||
254 | }, | 258 | }, |
255 | }, | 259 | }, |
256 | }, | 260 | }, |
257 | } | 261 | }; |
258 | 262 | ||
259 | export default authConfig | 263 | export default authConfig; |
diff --git a/config/bodyparser.ts b/config/bodyparser.ts index b3a027b..b8e6ed6 100644 --- a/config/bodyparser.ts +++ b/config/bodyparser.ts | |||
@@ -5,8 +5,8 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import { BodyParserConfig } from '@adonisjs/core/bodyparser' | 8 | import { BodyParserConfig } from '@adonisjs/core/bodyparser'; |
9 | import { defineConfig } from '@adonisjs/core/bodyparser' | 9 | import { defineConfig } from '@adonisjs/core/bodyparser'; |
10 | 10 | ||
11 | const bodyParserConfig = defineConfig({ | 11 | const bodyParserConfig = defineConfig({ |
12 | /* | 12 | /* |
@@ -201,6 +201,6 @@ const bodyParserConfig = defineConfig({ | |||
201 | */ | 201 | */ |
202 | types: ['multipart/form-data'], | 202 | types: ['multipart/form-data'], |
203 | }, | 203 | }, |
204 | }) | 204 | }); |
205 | 205 | ||
206 | export default bodyParserConfig | 206 | export default bodyParserConfig; |
diff --git a/config/cors.ts b/config/cors.ts index 911326f..ebb47aa 100644 --- a/config/cors.ts +++ b/config/cors.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { defineConfig } from '@adonisjs/cors' | 1 | import { defineConfig } from '@adonisjs/cors'; |
2 | 2 | ||
3 | const corsConfig = defineConfig({ | 3 | const corsConfig = defineConfig({ |
4 | /* | 4 | /* |
@@ -122,6 +122,6 @@ const corsConfig = defineConfig({ | |||
122 | | | 122 | | |
123 | */ | 123 | */ |
124 | maxAge: 90, | 124 | maxAge: 90, |
125 | }) | 125 | }); |
126 | 126 | ||
127 | export default corsConfig | 127 | export default corsConfig; |
diff --git a/config/dashboard.ts b/config/dashboard.ts index 9e92024..bbf7a71 100644 --- a/config/dashboard.ts +++ b/config/dashboard.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import env from '#start/env' | 1 | 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 d2db1c2..7e3774d 100644 --- a/config/database.ts +++ b/config/database.ts | |||
@@ -5,10 +5,10 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 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' | 10 | import { DatabaseConfig } from '@adonisjs/lucid/database'; |
11 | import { defineConfig } from '@adonisjs/lucid' | 11 | import { defineConfig } from '@adonisjs/lucid'; |
12 | 12 | ||
13 | const databaseConfig = defineConfig({ | 13 | const databaseConfig = defineConfig({ |
14 | /* | 14 | /* |
@@ -40,12 +40,12 @@ const databaseConfig = defineConfig({ | |||
40 | connection: { | 40 | connection: { |
41 | filename: path.join( | 41 | filename: path.join( |
42 | env.get('DATA_DIR', 'data'), | 42 | env.get('DATA_DIR', 'data'), |
43 | `${env.get('DB_DATABASE', 'ferdium')}.sqlite` | 43 | `${env.get('DB_DATABASE', 'ferdium')}.sqlite`, |
44 | ), | 44 | ), |
45 | }, | 45 | }, |
46 | pool: { | 46 | pool: { |
47 | afterCreate: (conn, cb) => { | 47 | afterCreate: (conn, cb) => { |
48 | conn.run('PRAGMA foreign_keys=true', cb) | 48 | conn.run('PRAGMA foreign_keys=true', cb); |
49 | }, | 49 | }, |
50 | }, | 50 | }, |
51 | migrations: { | 51 | migrations: { |
@@ -116,6 +116,6 @@ const databaseConfig = defineConfig({ | |||
116 | debug: env.get('DB_DEBUG', false), | 116 | debug: env.get('DB_DEBUG', false), |
117 | }, | 117 | }, |
118 | }, | 118 | }, |
119 | }) | 119 | }); |
120 | 120 | ||
121 | export default databaseConfig | 121 | export default databaseConfig; |
diff --git a/config/drive.ts b/config/drive.ts index f099303..98cc905 100644 --- a/config/drive.ts +++ b/config/drive.ts | |||
@@ -5,9 +5,9 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import env from '#start/env' | 8 | import env from '#start/env'; |
9 | import { driveConfig } from '@adonisjs/core/build/config' | 9 | import { driveConfig } from '@adonisjs/core/build/config'; |
10 | import { app } from '@adonisjs/core/services/app' | 10 | import { app } from '@adonisjs/core/services/app'; |
11 | 11 | ||
12 | /* | 12 | /* |
13 | |-------------------------------------------------------------------------- | 13 | |-------------------------------------------------------------------------- |
@@ -146,4 +146,4 @@ export default driveConfig({ | |||
146 | // usingUniformAcl: false, | 146 | // usingUniformAcl: false, |
147 | // }, | 147 | // }, |
148 | }, | 148 | }, |
149 | }) | 149 | }); |
diff --git a/config/hash.ts b/config/hash.ts index 22e38bd..38c8784 100644 --- a/config/hash.ts +++ b/config/hash.ts | |||
@@ -5,9 +5,9 @@ | |||
5 | * file. | 5 | * file. |
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 } from '@adonisjs/core/hash'; |
10 | import { drivers } from '@adonisjs/core/hash' | 10 | import { drivers } from '@adonisjs/core/hash'; |
11 | 11 | ||
12 | /* | 12 | /* |
13 | |-------------------------------------------------------------------------- | 13 | |-------------------------------------------------------------------------- |
@@ -83,7 +83,7 @@ export default defineConfig({ | |||
83 | driver: 'legacy', | 83 | driver: 'legacy', |
84 | }, | 84 | }, |
85 | }, | 85 | }, |
86 | }) | 86 | }); |
87 | 87 | ||
88 | declare module '@adonisjs/core/types' { | 88 | declare module '@adonisjs/core/types' { |
89 | export interface HashersList extends InferHashers<typeof hashConfig> {} | 89 | export interface HashersList extends InferHashers<typeof hashConfig> {} |
diff --git a/config/mail.ts b/config/mail.ts index 7d650d5..ac67231 100644 --- a/config/mail.ts +++ b/config/mail.ts | |||
@@ -5,8 +5,8 @@ | |||
5 | * file. | 5 | * file. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | import env from '#start/env' | 8 | import env from '#start/env'; |
9 | import { defineConfig } from '@adonisjs/mail' | 9 | import { defineConfig } from '@adonisjs/mail'; |
10 | 10 | ||
11 | export default defineConfig({ | 11 | export default defineConfig({ |
12 | /* | 12 | /* |
@@ -111,7 +111,7 @@ export default defineConfig({ | |||
111 | key: env.get('SPARKPOST_API_KEY'), | 111 | key: env.get('SPARKPOST_API_KEY'), |
112 | }), | 112 | }), |
113 | }, | 113 | }, |
114 | }) | 114 | }); |
115 | 115 | ||
116 | declare module '@adonisjs/mail/types' { | 116 | declare module '@adonisjs/mail/types' { |
117 | export interface MailersList extends InferMailers<typeof mailConfig> {} | 117 | export interface MailersList extends InferMailers<typeof mailConfig> {} |
diff --git a/config/session.ts b/config/session.ts index 299eec3..d3f5642 100644 --- a/config/session.ts +++ b/config/session.ts | |||
@@ -5,9 +5,9 @@ | |||
5 | * file. | 5 | * file. |
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({ |
13 | /* | 13 | /* |
@@ -113,4 +113,4 @@ export default defineConfig({ | |||
113 | | | 113 | | |
114 | */ | 114 | */ |
115 | redisConnection: 'local', | 115 | redisConnection: 'local', |
116 | }) | 116 | }); |
diff --git a/config/shield.ts b/config/shield.ts index c88df25..ed69aa2 100644 --- a/config/shield.ts +++ b/config/shield.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import env from '#start/env' | 1 | import env from '#start/env'; |
2 | import { defineConfig } from '@adonisjs/shield' | 2 | import { defineConfig } from '@adonisjs/shield'; |
3 | 3 | ||
4 | export default defineConfig({ | 4 | export default defineConfig({ |
5 | csp: { | 5 | csp: { |
@@ -67,9 +67,12 @@ export default defineConfig({ | |||
67 | | ``` | 67 | | ``` |
68 | | | 68 | | |
69 | */ | 69 | */ |
70 | exceptRoutes: (ctx) => { | 70 | exceptRoutes: ctx => { |
71 | // ignore all routes starting with /v1/ (api) | 71 | // ignore all routes starting with /v1/ (api) |
72 | return ctx.request.url().includes('/v1/') || ctx.request.url().includes('/import') | 72 | return ( |
73 | ctx.request.url().includes('/v1/') || | ||
74 | ctx.request.url().includes('/import') | ||
75 | ); | ||
73 | }, | 76 | }, |
74 | 77 | ||
75 | /* | 78 | /* |
@@ -135,4 +138,4 @@ export default defineConfig({ | |||
135 | contentTypeSniffing: { | 138 | contentTypeSniffing: { |
136 | enabled: true, | 139 | enabled: true, |
137 | }, | 140 | }, |
138 | }) | 141 | }); |
diff --git a/config/static.ts b/config/static.ts index 1d0d0c3..9ddeb9e 100644 --- a/config/static.ts +++ b/config/static.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { defineConfig } from '@adonisjs/static' | 1 | import { defineConfig } from '@adonisjs/static'; |
2 | 2 | ||
3 | const staticConfig = defineConfig({ | 3 | const staticConfig = defineConfig({ |
4 | enabled: true, | 4 | enabled: true, |
5 | dotFiles: 'ignore', | 5 | dotFiles: 'ignore', |
6 | etag: true, | 6 | etag: true, |
7 | lastModified: true, | 7 | lastModified: true, |
8 | }) | 8 | }); |
9 | 9 | ||
10 | export default staticConfig | 10 | export default staticConfig; |