summaryrefslogtreecommitdiffstats
path: root/config/app.ts
diff options
context:
space:
mode:
Diffstat (limited to 'config/app.ts')
-rw-r--r--config/app.ts84
1 files changed, 5 insertions, 79 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
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';
11import { LoggerConfig } from '@adonisjs/core/types/logger';
12import { ValidatorConfig } from '@adonisjs/validator/types'; 10import { ValidatorConfig } from '@adonisjs/validator/types';
13import { defineConfig } from '@adonisjs/core/http'; 11import { defineConfig } from '@adonisjs/core/http';
14 12
@@ -27,12 +25,12 @@ import { defineConfig } from '@adonisjs/core/http';
27*/ 25*/
28export const appKey: string = env.get('APP_KEY'); 26export const appKey: string = env.get('APP_KEY');
29 27
30export const url: string = env.get('APP_URL'); 28export 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)
33export const isRegistrationEnabled: string = env.get('IS_REGISTRATION_ENABLED'); 31export const isRegistrationEnabled = env.get('IS_REGISTRATION_ENABLED');
34export const connectWithFranz: string = env.get('CONNECT_WITH_FRANZ'); 32export const connectWithFranz = env.get('CONNECT_WITH_FRANZ');
35export const isCreationEnabled: string = env.get('IS_CREATION_ENABLED'); 33export const isCreationEnabled = env.get('IS_CREATION_ENABLED');
36export const jwtUsePEM: boolean = 34export 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*/
147export 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*/
201export const profiler: ProfilerConfig = { 127export const profiler = {
202 /* 128 /*
203 |-------------------------------------------------------------------------- 129 |--------------------------------------------------------------------------
204 | Toggle profiler 130 | Toggle profiler