2023-03-03 15:54:28 +00:00
|
|
|
/**
|
|
|
|
* Config source: https://git.io/JfefZ
|
|
|
|
*
|
|
|
|
* Feel free to let us know via PR, if you find something broken in this config
|
|
|
|
* file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import proxyAddr from 'proxy-addr';
|
2024-03-14 19:25:27 +00:00
|
|
|
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";
|
2024-05-21 12:41:10 +00:00
|
|
|
// import { ValidatorConfig } from "@adonisjs/validator/types";
|
2024-06-14 10:38:04 +00:00
|
|
|
import { defineConfig } from '@adonisjs/core/http';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Application secret key
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| The secret to encrypt and sign different values in your application.
|
|
|
|
| Make sure to keep the `APP_KEY` as an environment variable and secure.
|
|
|
|
|
|
|
|
|
| Note: Changing the application key for an existing app will make all
|
|
|
|
| the cookies invalid and also the existing encrypted data will not
|
|
|
|
| be decrypted.
|
|
|
|
|
|
|
|
|
*/
|
2024-03-14 19:25:27 +00:00
|
|
|
export const appKey: string = env.get('APP_KEY');
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Http server configuration
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| The configuration for the HTTP(s) server. Make sure to go through all
|
|
|
|
| the config properties to make keep server secure.
|
|
|
|
|
|
|
|
|
*/
|
2024-03-14 19:25:27 +00:00
|
|
|
export const http = defineConfig({
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| 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.
|
|
|
|
|
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
allowMethodSpoofing: false,
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Subdomain offset
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
subdomainOffset: 2,
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| 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.
|
|
|
|
|
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
generateRequestId: false,
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Trusting proxy servers
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Define the proxy servers that AdonisJs must trust for reading `X-Forwarded`
|
|
|
|
| headers.
|
|
|
|
|
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
trustProxy: proxyAddr.compile('loopback'),
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2023-03-03 15:54:28 +00:00
|
|
|
|--------------------------------------------------------------------------
|
2024-03-14 19:25:27 +00:00
|
|
|
| Generating Etag
|
2023-03-03 15:54:28 +00:00
|
|
|
|--------------------------------------------------------------------------
|
2024-03-14 19:25:27 +00:00
|
|
|
|
|
|
|
|
| Whether or not to generate an etag for every response.
|
|
|
|
|
|
2023-03-03 15:54:28 +00:00
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
etag: false,
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| JSONP Callback
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
jsonpCallbackName: 'callback',
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2024-06-14 10:38:04 +00:00
|
|
|
/*
|
2024-03-14 19:25:27 +00:00
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cookie settings
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
*/
|
2024-06-14 10:38:04 +00:00
|
|
|
cookie: {
|
|
|
|
domain: '',
|
|
|
|
path: '/',
|
|
|
|
maxAge: '2h',
|
|
|
|
httpOnly: true,
|
|
|
|
secure: false,
|
|
|
|
sameSite: false,
|
|
|
|
},
|
2024-03-14 19:25:27 +00:00
|
|
|
});
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Profiler
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
*/
|
2024-03-14 19:25:27 +00:00
|
|
|
// 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: [],
|
|
|
|
|
|
|
|
// /*
|
|
|
|
// |--------------------------------------------------------------------------
|
|
|
|
// | 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: [],
|
|
|
|
// };
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Validator
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Configure the global configuration for the validator. Here's the reference
|
|
|
|
| to the default config https://git.io/JT0WE
|
|
|
|
|
|
|
|
|
*/
|
2024-05-21 12:41:10 +00:00
|
|
|
export const validator = {};
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Assets
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Configure the asset manager you are using to compile the frontend assets
|
|
|
|
|
|
|
|
|
*/
|
2024-03-14 19:25:27 +00:00
|
|
|
// 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: app.publicPath('assets'),
|
|
|
|
|
|
|
|
// /*
|
|
|
|
// |--------------------------------------------------------------------------
|
|
|
|
// | Script tag
|
|
|
|
// |--------------------------------------------------------------------------
|
|
|
|
// |
|
|
|
|
// | Define attributes for the entryPointScripts tags
|
|
|
|
// |
|
|
|
|
// */
|
|
|
|
// script: {
|
|
|
|
// attributes: {
|
|
|
|
// defer: true,
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
|
|
|
|
// /*
|
|
|
|
// |--------------------------------------------------------------------------
|
|
|
|
// | Style tag
|
|
|
|
// |--------------------------------------------------------------------------
|
|
|
|
// |
|
|
|
|
// | Define attributes for the entryPointStyles tags
|
|
|
|
// |
|
|
|
|
// */
|
|
|
|
// style: {
|
|
|
|
// attributes: {},
|
|
|
|
// },
|
|
|
|
// };
|