diff options
author | 2024-02-10 18:19:14 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | 7584d2d7a7110aef0331ebfa178b2295842c59fa (patch) | |
tree | 900cd71237e6231b57936fcce77ff229cd459041 /config/app.ts | |
parent | upgrade recipes submodule (diff) | |
download | ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.gz ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.zst ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.zip |
refactor: project maintenance
- work in progress
Diffstat (limited to 'config/app.ts')
-rw-r--r-- | config/app.ts | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/config/app.ts b/config/app.ts index fb3c0be..135f20f 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 '@ioc:Adonis/Core/Env'; | 9 | import env from '#start/env' |
10 | import { ServerConfig } from '@ioc:Adonis/Core/Server'; | 10 | import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler' |
11 | import { LoggerConfig } from '@ioc:Adonis/Core/Logger'; | 11 | import { LoggerConfig } from '@adonisjs/core/types/logger' |
12 | import { ProfilerConfig } from '@ioc:Adonis/Core/Profiler'; | 12 | import { ValidatorConfig } from '@adonisjs/validator/types' |
13 | import { ValidatorConfig } from '@ioc:Adonis/Core/Validator'; | 13 | import { defineConfig } from '@adonisjs/core/http' |
14 | 14 | ||
15 | /* | 15 | /* |
16 | |-------------------------------------------------------------------------- | 16 | |-------------------------------------------------------------------------- |
@@ -25,18 +25,17 @@ import { ValidatorConfig } from '@ioc:Adonis/Core/Validator'; | |||
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', '') !== '' && | 38 | (env.get('JWT_PUBLIC_KEY', '') !== '' && env.get('JWT_PRIVATE_KEY', '') !== '') |
39 | Env.get('JWT_PRIVATE_KEY', '') !== ''); | ||
40 | /* | 39 | /* |
41 | |-------------------------------------------------------------------------- | 40 | |-------------------------------------------------------------------------- |
42 | | Http server configuration | 41 | | Http server configuration |
@@ -46,7 +45,7 @@ export const jwtUsePEM: boolean = | |||
46 | | the config properties to make keep server secure. | 45 | | the config properties to make keep server secure. |
47 | | | 46 | | |
48 | */ | 47 | */ |
49 | export const http: ServerConfig = { | 48 | export const http = defineConfig({ |
50 | /* | 49 | /* |
51 | |-------------------------------------------------------------------------- | 50 | |-------------------------------------------------------------------------- |
52 | | Allow method spoofing | 51 | | Allow method spoofing |
@@ -137,7 +136,7 @@ export const http: ServerConfig = { | |||
137 | | | 136 | | |
138 | */ | 137 | */ |
139 | forceContentNegotiationTo: 'application/json', | 138 | forceContentNegotiationTo: 'application/json', |
140 | }; | 139 | }) |
141 | 140 | ||
142 | /* | 141 | /* |
143 | |-------------------------------------------------------------------------- | 142 | |-------------------------------------------------------------------------- |
@@ -157,7 +156,7 @@ export const logger: LoggerConfig = { | |||
157 | | reading the `name` property from the `package.json` file. | 156 | | reading the `name` property from the `package.json` file. |
158 | | | 157 | | |
159 | */ | 158 | */ |
160 | name: Env.get('APP_NAME', 'Ferdium-server'), | 159 | name: env.get('APP_NAME', 'Ferdium-server'), |
161 | 160 | ||
162 | /* | 161 | /* |
163 | |-------------------------------------------------------------------------- | 162 | |-------------------------------------------------------------------------- |
@@ -179,7 +178,7 @@ export const logger: LoggerConfig = { | |||
179 | | at deployment level and not code level. | 178 | | at deployment level and not code level. |
180 | | | 179 | | |
181 | */ | 180 | */ |
182 | level: Env.get('LOG_LEVEL', 'info'), | 181 | level: env.get('LOG_LEVEL', 'info'), |
183 | 182 | ||
184 | /* | 183 | /* |
185 | |-------------------------------------------------------------------------- | 184 | |-------------------------------------------------------------------------- |
@@ -190,8 +189,8 @@ export const logger: LoggerConfig = { | |||
190 | | can have huge impact on performance. | 189 | | can have huge impact on performance. |
191 | | | 190 | | |
192 | */ | 191 | */ |
193 | prettyPrint: Env.get('NODE_ENV') === 'development', | 192 | prettyPrint: env.get('NODE_ENV') === 'development', |
194 | }; | 193 | } |
195 | 194 | ||
196 | /* | 195 | /* |
197 | |-------------------------------------------------------------------------- | 196 | |-------------------------------------------------------------------------- |
@@ -230,7 +229,7 @@ export const profiler: ProfilerConfig = { | |||
230 | | | 229 | | |
231 | */ | 230 | */ |
232 | whitelist: [], | 231 | whitelist: [], |
233 | }; | 232 | } |
234 | 233 | ||
235 | /* | 234 | /* |
236 | |-------------------------------------------------------------------------- | 235 | |-------------------------------------------------------------------------- |
@@ -241,4 +240,4 @@ export const profiler: ProfilerConfig = { | |||
241 | | to the default config https://git.io/JT0WE | 240 | | to the default config https://git.io/JT0WE |
242 | | | 241 | | |
243 | */ | 242 | */ |
244 | export const validator: ValidatorConfig = {}; | 243 | export const validator: ValidatorConfig = {} |