- update to AdonisJS 6
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m15s

This commit is contained in:
Kaimbacher 2024-03-14 20:25:27 +01:00
parent f828ca4491
commit cb51a4136f
167 changed files with 21485 additions and 21212 deletions

View file

@ -6,13 +6,14 @@
*/
import proxyAddr from 'proxy-addr';
import Env from '@ioc:Adonis/Core/Env';
import Application from '@ioc:Adonis/Core/Application';
import type { ServerConfig } from '@ioc:Adonis/Core/Server';
import type { LoggerConfig } from '@ioc:Adonis/Core/Logger';
import type { ProfilerConfig } from '@ioc:Adonis/Core/Profiler';
import type { ValidatorConfig } from '@ioc:Adonis/Core/Validator';
import type { AssetsManagerConfig } from '@ioc:Adonis/Core/AssetsManager';
import env from '#start/env';
// import app from '@adonisjs/core/services/app';
// import type { ProfilerConfig } from '@ioc:Adonis/Core/Profiler';
// import type { AssetsManagerConfig } from '@ioc:Adonis/Core/AssetsManager';
// import { ServerConfig } from "@adonisjs/core/services/server";
// import { LoggerConfig } from "@adonisjs/core/types/logger";
import { ValidatorConfig } from "@adonisjs/validator/types";
import { defineConfig } from "@adonisjs/core/http";
/*
|--------------------------------------------------------------------------
@ -27,7 +28,7 @@ import type { AssetsManagerConfig } from '@ioc:Adonis/Core/AssetsManager';
| be decrypted.
|
*/
export const appKey: string = Env.get('APP_KEY');
export const appKey: string = env.get('APP_KEY');
/*
|--------------------------------------------------------------------------
@ -38,176 +39,120 @@ export const appKey: string = Env.get('APP_KEY');
| the config properties to make keep server secure.
|
*/
export const http: ServerConfig = {
/*
|--------------------------------------------------------------------------
| Allow method spoofing
|--------------------------------------------------------------------------
|
| Method spoofing enables defining custom HTTP methods using a query string
| `_method`. This is usually required when you are making traditional
| form requests and wants to use HTTP verbs like `PUT`, `DELETE` and
| so on.
|
*/
allowMethodSpoofing: false,
/*
|--------------------------------------------------------------------------
| Subdomain offset
|--------------------------------------------------------------------------
*/
subdomainOffset: 2,
/*
|--------------------------------------------------------------------------
| Request Ids
|--------------------------------------------------------------------------
|
| Setting this value to `true` will generate a unique request id for each
| HTTP request and set it as `x-request-id` header.
|
*/
generateRequestId: false,
/*
|--------------------------------------------------------------------------
| Trusting proxy servers
|--------------------------------------------------------------------------
|
| Define the proxy servers that AdonisJs must trust for reading `X-Forwarded`
| headers.
|
*/
trustProxy: proxyAddr.compile('loopback'),
/*
|--------------------------------------------------------------------------
| Generating Etag
|--------------------------------------------------------------------------
|
| Whether or not to generate an etag for every response.
|
*/
etag: false,
/*
|--------------------------------------------------------------------------
| JSONP Callback
|--------------------------------------------------------------------------
*/
jsonpCallbackName: 'callback',
/*
|--------------------------------------------------------------------------
| Cookie settings
|--------------------------------------------------------------------------
*/
cookie: {
domain: '',
path: '/',
maxAge: '2h',
httpOnly: true,
secure: false,
sameSite: false,
},
};
/*
export const http = defineConfig({
/*
|--------------------------------------------------------------------------
| Logger
| Allow method spoofing
|--------------------------------------------------------------------------
|
| Method spoofing enables defining custom HTTP methods using a query string
| `_method`. This is usually required when you are making traditional
| form requests and wants to use HTTP verbs like `PUT`, `DELETE` and
| so on.
|
*/
allowMethodSpoofing: false,
/*
|--------------------------------------------------------------------------
| Subdomain offset
|--------------------------------------------------------------------------
*/
export const logger: LoggerConfig = {
/*
|--------------------------------------------------------------------------
| Application name
|--------------------------------------------------------------------------
|
| The name of the application you want to add to the log. It is recommended
| to always have app name in every log line.
|
| The `APP_NAME` environment variable is automatically set by AdonisJS by
| reading the `name` property from the `package.json` file.
|
*/
name: Env.get('APP_NAME'),
subdomainOffset: 2,
/*
|--------------------------------------------------------------------------
| Toggle logger
|--------------------------------------------------------------------------
|
| Enable or disable logger application wide
|
*/
enabled: true,
/*
|--------------------------------------------------------------------------
| Request Ids
|--------------------------------------------------------------------------
|
| Setting this value to `true` will generate a unique request id for each
| HTTP request and set it as `x-request-id` header.
|
*/
generateRequestId: false,
/*
|--------------------------------------------------------------------------
| Logging level
|--------------------------------------------------------------------------
|
| The level from which you want the logger to flush logs. It is recommended
| to make use of the environment variable, so that you can define log levels
| at deployment level and not code level.
|
*/
level: Env.get('LOG_LEVEL', 'info'),
redact: {
paths: ['password', '*.password'],
},
/*
|--------------------------------------------------------------------------
| Trusting proxy servers
|--------------------------------------------------------------------------
|
| Define the proxy servers that AdonisJs must trust for reading `X-Forwarded`
| headers.
|
*/
trustProxy: proxyAddr.compile('loopback'),
/*
|--------------------------------------------------------------------------
| Generating Etag
|--------------------------------------------------------------------------
|
| Whether or not to generate an etag for every response.
|
*/
etag: false,
/*
|--------------------------------------------------------------------------
| JSONP Callback
|--------------------------------------------------------------------------
*/
jsonpCallbackName: 'callback',
/*
|--------------------------------------------------------------------------
| Cookie settings
|--------------------------------------------------------------------------
*/
cookie: {
domain: '',
path: '/',
maxAge: '2h',
httpOnly: true,
secure: false,
sameSite: false,
},
});
/*
|--------------------------------------------------------------------------
| Pretty print
|--------------------------------------------------------------------------
|
| It is highly advised NOT to use `prettyPrint` in production, since it
| can have huge impact on performance.
|
*/
prettyPrint: Env.get('NODE_ENV') === 'development',
};
/*
|--------------------------------------------------------------------------
| Profiler
|--------------------------------------------------------------------------
*/
export const profiler: ProfilerConfig = {
/*
|--------------------------------------------------------------------------
| Toggle profiler
|--------------------------------------------------------------------------
|
| Enable or disable profiler
|
*/
enabled: true,
// export const profiler: ProfilerConfig = {
// /*
// |--------------------------------------------------------------------------
// | Toggle profiler
// |--------------------------------------------------------------------------
// |
// | Enable or disable profiler
// |
// */
// enabled: true,
/*
|--------------------------------------------------------------------------
| Blacklist actions/row labels
|--------------------------------------------------------------------------
|
| Define an array of actions or row labels that you want to disable from
| getting profiled.
|
*/
blacklist: [],
// /*
// |--------------------------------------------------------------------------
// | Blacklist actions/row labels
// |--------------------------------------------------------------------------
// |
// | Define an array of actions or row labels that you want to disable from
// | getting profiled.
// |
// */
// blacklist: [],
/*
|--------------------------------------------------------------------------
| Whitelist actions/row labels
|--------------------------------------------------------------------------
|
| Define an array of actions or row labels that you want to whitelist for
| the profiler. When whitelist is defined, then `blacklist` is ignored.
|
*/
whitelist: [],
};
// /*
// |--------------------------------------------------------------------------
// | Whitelist actions/row labels
// |--------------------------------------------------------------------------
// |
// | Define an array of actions or row labels that you want to whitelist for
// | the profiler. When whitelist is defined, then `blacklist` is ignored.
// |
// */
// whitelist: [],
// };
/*
|--------------------------------------------------------------------------
@ -228,52 +173,52 @@ export const validator: ValidatorConfig = {};
| Configure the asset manager you are using to compile the frontend assets
|
*/
export const assets: AssetsManagerConfig = {
/*
|--------------------------------------------------------------------------
| Driver
|--------------------------------------------------------------------------
|
| Currently we only support webpack encore and may introduce more drivers
| in the future
|
*/
driver: Env.get('ASSETS_DRIVER'),
// export const assets: AssetsManagerConfig = {
// /*
// |--------------------------------------------------------------------------
// | Driver
// |--------------------------------------------------------------------------
// |
// | Currently we only support webpack encore and may introduce more drivers
// | in the future
// |
// */
// driver: env.get('ASSETS_DRIVER'),
/*
|--------------------------------------------------------------------------
| Public path
|--------------------------------------------------------------------------
|
| Directory to search for the "manifest.json" and the "entrypoints.json"
| files
|
*/
publicPath: Application.publicPath('assets'),
// /*
// |--------------------------------------------------------------------------
// | Public path
// |--------------------------------------------------------------------------
// |
// | Directory to search for the "manifest.json" and the "entrypoints.json"
// | files
// |
// */
// publicPath: app.publicPath('assets'),
/*
|--------------------------------------------------------------------------
| Script tag
|--------------------------------------------------------------------------
|
| Define attributes for the entryPointScripts tags
|
*/
script: {
attributes: {
defer: true,
},
},
// /*
// |--------------------------------------------------------------------------
// | Script tag
// |--------------------------------------------------------------------------
// |
// | Define attributes for the entryPointScripts tags
// |
// */
// script: {
// attributes: {
// defer: true,
// },
// },
/*
|--------------------------------------------------------------------------
| Style tag
|--------------------------------------------------------------------------
|
| Define attributes for the entryPointStyles tags
|
*/
style: {
attributes: {},
},
};
// /*
// |--------------------------------------------------------------------------
// | Style tag
// |--------------------------------------------------------------------------
// |
// | Define attributes for the entryPointStyles tags
// |
// */
// style: {
// attributes: {},
// },
// };