summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2024-02-10 18:37:40 -0700
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2024-02-13 06:59:44 +0530
commite1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch)
tree2dccff36a441916d7014037cef3f7ce84a790cad /config
parentrefactor: project maintenance (diff)
downloadferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz
ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst
ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip
updates
Diffstat (limited to 'config')
-rw-r--r--config/app.ts33
-rw-r--r--config/auth.ts18
-rw-r--r--config/bodyparser.ts8
-rw-r--r--config/cors.ts6
-rw-r--r--config/dashboard.ts6
-rw-r--r--config/database.ts16
-rw-r--r--config/drive.ts8
-rw-r--r--config/hash.ts8
-rw-r--r--config/mail.ts6
-rw-r--r--config/session.ts8
-rw-r--r--config/shield.ts13
-rw-r--r--config/static.ts6
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
8import proxyAddr from 'proxy-addr' 8import proxyAddr from 'proxy-addr';
9import env from '#start/env' 9import env from '#start/env';
10import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler' 10import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler';
11import { LoggerConfig } from '@adonisjs/core/types/logger' 11import { LoggerConfig } from '@adonisjs/core/types/logger';
12import { ValidatorConfig } from '@adonisjs/validator/types' 12import { ValidatorConfig } from '@adonisjs/validator/types';
13import { defineConfig } from '@adonisjs/core/http' 13import { 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*/
28export const appKey: string = env.get('APP_KEY') 28export const appKey: string = env.get('APP_KEY');
29 29
30export const url: string = env.get('APP_URL') 30export 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)
33export const isRegistrationEnabled: string = env.get('IS_REGISTRATION_ENABLED') 33export const isRegistrationEnabled: string = env.get('IS_REGISTRATION_ENABLED');
34export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ') 34export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ');
35export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED') 35export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED');
36export const jwtUsePEM: boolean = 36export 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*/
243export const validator: ValidatorConfig = {} 244export 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
8import { AuthConfig } from '@ioc:Adonis/Addons/Auth' 8import { AuthConfig } from '@ioc:Adonis/Addons/Auth';
9import env from '#start/env' 9import env from '#start/env';
10import { appKey, jwtUsePEM } from './app.js' 10import { 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
259export default authConfig 263export 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
8import { BodyParserConfig } from '@adonisjs/core/bodyparser' 8import { BodyParserConfig } from '@adonisjs/core/bodyparser';
9import { defineConfig } from '@adonisjs/core/bodyparser' 9import { defineConfig } from '@adonisjs/core/bodyparser';
10 10
11const bodyParserConfig = defineConfig({ 11const 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
206export default bodyParserConfig 206export 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 @@
1import { defineConfig } from '@adonisjs/cors' 1import { defineConfig } from '@adonisjs/cors';
2 2
3const corsConfig = defineConfig({ 3const 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
127export default corsConfig 127export 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 @@
1import env from '#start/env' 1import env from '#start/env';
2 2
3export const enabled: boolean = env.get('IS_DASHBOARD_ENABLED') !== 'false' 3export const enabled: boolean = env.get('IS_DASHBOARD_ENABLED') !== 'false';
4 4
5export const mailFrom: string = env.get('MAIL_SENDER') 5export 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
8import path from 'node:path' 8import path from 'node:path';
9import env from '#start/env' 9import env from '#start/env';
10import { DatabaseConfig } from '@adonisjs/lucid/database' 10import { DatabaseConfig } from '@adonisjs/lucid/database';
11import { defineConfig } from '@adonisjs/lucid' 11import { defineConfig } from '@adonisjs/lucid';
12 12
13const databaseConfig = defineConfig({ 13const 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
121export default databaseConfig 121export 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
8import env from '#start/env' 8import env from '#start/env';
9import { driveConfig } from '@adonisjs/core/build/config' 9import { driveConfig } from '@adonisjs/core/build/config';
10import { app } from '@adonisjs/core/services/app' 10import { 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
8import env from '#start/env' 8import env from '#start/env';
9import { defineConfig } from '@adonisjs/core/hash' 9import { defineConfig } from '@adonisjs/core/hash';
10import { drivers } from '@adonisjs/core/hash' 10import { 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
88declare module '@adonisjs/core/types' { 88declare 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
8import env from '#start/env' 8import env from '#start/env';
9import { defineConfig } from '@adonisjs/mail' 9import { defineConfig } from '@adonisjs/mail';
10 10
11export default defineConfig({ 11export 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
116declare module '@adonisjs/mail/types' { 116declare 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
8import env from '#start/env' 8import env from '#start/env';
9import { app } from '@adonisjs/core/services/app' 9import { app } from '@adonisjs/core/services/app';
10import { defineConfig } from '@adonisjs/session' 10import { defineConfig } from '@adonisjs/session';
11 11
12export default defineConfig({ 12export 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 @@
1import env from '#start/env' 1import env from '#start/env';
2import { defineConfig } from '@adonisjs/shield' 2import { defineConfig } from '@adonisjs/shield';
3 3
4export default defineConfig({ 4export 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 @@
1import { defineConfig } from '@adonisjs/static' 1import { defineConfig } from '@adonisjs/static';
2 2
3const staticConfig = defineConfig({ 3const 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
10export default staticConfig 10export default staticConfig;