Mercurial
comparison benchmark/bun-http-framework-benchmark/dev/adonis/config/app.ts @ 183:a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 23 Jan 2026 21:19:08 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 179:8d17f6e6e290 | 183:a8976a008a9d |
|---|---|
| 1 /** | |
| 2 * Config source: https://git.io/JfefZ | |
| 3 * | |
| 4 * Feel free to let us know via PR, if you find something broken in this config | |
| 5 * file. | |
| 6 */ | |
| 7 | |
| 8 import proxyAddr from 'proxy-addr' | |
| 9 import Env from '@ioc:Adonis/Core/Env' | |
| 10 import type { ServerConfig } from '@ioc:Adonis/Core/Server' | |
| 11 import type { LoggerConfig } from '@ioc:Adonis/Core/Logger' | |
| 12 import type { ProfilerConfig } from '@ioc:Adonis/Core/Profiler' | |
| 13 import type { ValidatorConfig } from '@ioc:Adonis/Core/Validator' | |
| 14 | |
| 15 /* | |
| 16 |-------------------------------------------------------------------------- | |
| 17 | Application secret key | |
| 18 |-------------------------------------------------------------------------- | |
| 19 | | |
| 20 | The secret to encrypt and sign different values in your application. | |
| 21 | Make sure to keep the `APP_KEY` as an environment variable and secure. | |
| 22 | | |
| 23 | Note: Changing the application key for an existing app will make all | |
| 24 | the cookies invalid and also the existing encrypted data will not | |
| 25 | be decrypted. | |
| 26 | | |
| 27 */ | |
| 28 export const appKey: string = Env.get('APP_KEY') | |
| 29 | |
| 30 /* | |
| 31 |-------------------------------------------------------------------------- | |
| 32 | Http server configuration | |
| 33 |-------------------------------------------------------------------------- | |
| 34 | | |
| 35 | The configuration for the HTTP(s) server. Make sure to go through all | |
| 36 | the config properties to make keep server secure. | |
| 37 | | |
| 38 */ | |
| 39 export const http: ServerConfig = { | |
| 40 /* | |
| 41 |-------------------------------------------------------------------------- | |
| 42 | Allow method spoofing | |
| 43 |-------------------------------------------------------------------------- | |
| 44 | | |
| 45 | Method spoofing enables defining custom HTTP methods using a query string | |
| 46 | `_method`. This is usually required when you are making traditional | |
| 47 | form requests and wants to use HTTP verbs like `PUT`, `DELETE` and | |
| 48 | so on. | |
| 49 | | |
| 50 */ | |
| 51 allowMethodSpoofing: false, | |
| 52 | |
| 53 /* | |
| 54 |-------------------------------------------------------------------------- | |
| 55 | Subdomain offset | |
| 56 |-------------------------------------------------------------------------- | |
| 57 */ | |
| 58 subdomainOffset: 2, | |
| 59 | |
| 60 /* | |
| 61 |-------------------------------------------------------------------------- | |
| 62 | Request Ids | |
| 63 |-------------------------------------------------------------------------- | |
| 64 | | |
| 65 | Setting this value to `true` will generate a unique request id for each | |
| 66 | HTTP request and set it as `x-request-id` header. | |
| 67 | | |
| 68 */ | |
| 69 generateRequestId: false, | |
| 70 | |
| 71 /* | |
| 72 |-------------------------------------------------------------------------- | |
| 73 | Trusting proxy servers | |
| 74 |-------------------------------------------------------------------------- | |
| 75 | | |
| 76 | Define the proxy servers that AdonisJs must trust for reading `X-Forwarded` | |
| 77 | headers. | |
| 78 | | |
| 79 */ | |
| 80 trustProxy: proxyAddr.compile('loopback'), | |
| 81 | |
| 82 /* | |
| 83 |-------------------------------------------------------------------------- | |
| 84 | Generating Etag | |
| 85 |-------------------------------------------------------------------------- | |
| 86 | | |
| 87 | Whether or not to generate an etag for every response. | |
| 88 | | |
| 89 */ | |
| 90 etag: false, | |
| 91 | |
| 92 /* | |
| 93 |-------------------------------------------------------------------------- | |
| 94 | JSONP Callback | |
| 95 |-------------------------------------------------------------------------- | |
| 96 */ | |
| 97 jsonpCallbackName: 'callback', | |
| 98 | |
| 99 /* | |
| 100 |-------------------------------------------------------------------------- | |
| 101 | Cookie settings | |
| 102 |-------------------------------------------------------------------------- | |
| 103 */ | |
| 104 cookie: { | |
| 105 domain: '', | |
| 106 path: '/', | |
| 107 maxAge: '2h', | |
| 108 httpOnly: true, | |
| 109 secure: false, | |
| 110 sameSite: false, | |
| 111 }, | |
| 112 } | |
| 113 | |
| 114 /* | |
| 115 |-------------------------------------------------------------------------- | |
| 116 | Logger | |
| 117 |-------------------------------------------------------------------------- | |
| 118 */ | |
| 119 export const logger: LoggerConfig = { | |
| 120 /* | |
| 121 |-------------------------------------------------------------------------- | |
| 122 | Application name | |
| 123 |-------------------------------------------------------------------------- | |
| 124 | | |
| 125 | The name of the application you want to add to the log. It is recommended | |
| 126 | to always have app name in every log line. | |
| 127 | | |
| 128 | The `APP_NAME` environment variable is automatically set by AdonisJS by | |
| 129 | reading the `name` property from the `package.json` file. | |
| 130 | | |
| 131 */ | |
| 132 name: Env.get('APP_NAME'), | |
| 133 | |
| 134 /* | |
| 135 |-------------------------------------------------------------------------- | |
| 136 | Toggle logger | |
| 137 |-------------------------------------------------------------------------- | |
| 138 | | |
| 139 | Enable or disable logger application wide | |
| 140 | | |
| 141 */ | |
| 142 enabled: true, | |
| 143 | |
| 144 /* | |
| 145 |-------------------------------------------------------------------------- | |
| 146 | Logging level | |
| 147 |-------------------------------------------------------------------------- | |
| 148 | | |
| 149 | The level from which you want the logger to flush logs. It is recommended | |
| 150 | to make use of the environment variable, so that you can define log levels | |
| 151 | at deployment level and not code level. | |
| 152 | | |
| 153 */ | |
| 154 level: Env.get('LOG_LEVEL', 'info'), | |
| 155 | |
| 156 /* | |
| 157 |-------------------------------------------------------------------------- | |
| 158 | Pretty print | |
| 159 |-------------------------------------------------------------------------- | |
| 160 | | |
| 161 | It is highly advised NOT to use `prettyPrint` in production, since it | |
| 162 | can have huge impact on performance. | |
| 163 | | |
| 164 */ | |
| 165 prettyPrint: Env.get('NODE_ENV') === 'development', | |
| 166 } | |
| 167 | |
| 168 /* | |
| 169 |-------------------------------------------------------------------------- | |
| 170 | Profiler | |
| 171 |-------------------------------------------------------------------------- | |
| 172 */ | |
| 173 export const profiler: ProfilerConfig = { | |
| 174 /* | |
| 175 |-------------------------------------------------------------------------- | |
| 176 | Toggle profiler | |
| 177 |-------------------------------------------------------------------------- | |
| 178 | | |
| 179 | Enable or disable profiler | |
| 180 | | |
| 181 */ | |
| 182 enabled: true, | |
| 183 | |
| 184 /* | |
| 185 |-------------------------------------------------------------------------- | |
| 186 | Blacklist actions/row labels | |
| 187 |-------------------------------------------------------------------------- | |
| 188 | | |
| 189 | Define an array of actions or row labels that you want to disable from | |
| 190 | getting profiled. | |
| 191 | | |
| 192 */ | |
| 193 blacklist: [], | |
| 194 | |
| 195 /* | |
| 196 |-------------------------------------------------------------------------- | |
| 197 | Whitelist actions/row labels | |
| 198 |-------------------------------------------------------------------------- | |
| 199 | | |
| 200 | Define an array of actions or row labels that you want to whitelist for | |
| 201 | the profiler. When whitelist is defined, then `blacklist` is ignored. | |
| 202 | | |
| 203 */ | |
| 204 whitelist: [], | |
| 205 } | |
| 206 | |
| 207 /* | |
| 208 |-------------------------------------------------------------------------- | |
| 209 | Validator | |
| 210 |-------------------------------------------------------------------------- | |
| 211 | | |
| 212 | Configure the global configuration for the validator. Here's the reference | |
| 213 | to the default config https://git.io/JT0WE | |
| 214 | | |
| 215 */ | |
| 216 export const validator: ValidatorConfig = {} |