app.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. 'use strict'
  2. /** @type {import('@adonisjs/framework/src/Env')} */
  3. const Env = use('Env')
  4. module.exports = {
  5. /*
  6. |--------------------------------------------------------------------------
  7. | Application Name
  8. |--------------------------------------------------------------------------
  9. |
  10. | This value is the name of your application and can be used when you
  11. | need to place the application's name in a email, view or
  12. | other location.
  13. |
  14. */
  15. name: Env.get('APP_NAME', 'AdonisJs'),
  16. /*
  17. |--------------------------------------------------------------------------
  18. | App Key
  19. |--------------------------------------------------------------------------
  20. |
  21. | App key is a randomly generated 16 or 32 characters long string required
  22. | to encrypted cookies, sessions and other sensitive data.
  23. |
  24. */
  25. appKey: Env.getOrFail('APP_KEY'),
  26. http: {
  27. /*
  28. |--------------------------------------------------------------------------
  29. | Allow Method Spoofing
  30. |--------------------------------------------------------------------------
  31. |
  32. | Method spoofing allows you to make requests by spoofing the http verb.
  33. | Which means you can make a GET request but instruct the server to
  34. | treat as a POST or PUT request. If you want this feature, set the
  35. | below value to true.
  36. |
  37. */
  38. allowMethodSpoofing: true,
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Trust Proxy
  42. |--------------------------------------------------------------------------
  43. |
  44. | Trust proxy defines whether X-Forwarded-* headers should be trusted or not.
  45. | When your application is behind a proxy server like nginx, these values
  46. | are set automatically and should be trusted. Apart from setting it
  47. | to true or false Adonis supports a handful of ways to allow proxy
  48. | values. Read documentation for that.
  49. |
  50. */
  51. trustProxy: false,
  52. /*
  53. |--------------------------------------------------------------------------
  54. | Subdomains
  55. |--------------------------------------------------------------------------
  56. |
  57. | Offset to be used for returning subdomains for a given request. For
  58. | majority of applications it will be 2, until you have nested
  59. | sudomains.
  60. | cheatsheet.adonisjs.com - offset - 2
  61. | virk.cheatsheet.adonisjs.com - offset - 3
  62. |
  63. */
  64. subdomainOffset: 2,
  65. /*
  66. |--------------------------------------------------------------------------
  67. | JSONP Callback
  68. |--------------------------------------------------------------------------
  69. |
  70. | Default jsonp callback to be used when callback query string is missing
  71. | in request url.
  72. |
  73. */
  74. jsonpCallback: 'callback',
  75. /*
  76. |--------------------------------------------------------------------------
  77. | Etag
  78. |--------------------------------------------------------------------------
  79. |
  80. | Set etag on all HTTP responses. In order to disable for selected routes,
  81. | you can call the `response.send` with an options object as follows.
  82. |
  83. | response.send('Hello', { ignoreEtag: true })
  84. |
  85. */
  86. etag: false
  87. },
  88. views: {
  89. /*
  90. |--------------------------------------------------------------------------
  91. | Cache Views
  92. |--------------------------------------------------------------------------
  93. |
  94. | Define whether or not to cache the compiled view. Set it to true in
  95. | production to optimize view loading time.
  96. |
  97. */
  98. cache: Env.get('CACHE_VIEWS', true)
  99. },
  100. static: {
  101. /*
  102. |--------------------------------------------------------------------------
  103. | Dot Files
  104. |--------------------------------------------------------------------------
  105. |
  106. | Define how to treat dot files when trying to serve static resources.
  107. | By default it is set to ignore, which will pretend that dotfiles
  108. | do not exist.
  109. |
  110. | Can be one of the following
  111. | ignore, deny, allow
  112. |
  113. */
  114. dotfiles: 'ignore',
  115. /*
  116. |--------------------------------------------------------------------------
  117. | ETag
  118. |--------------------------------------------------------------------------
  119. |
  120. | Enable or disable etag generation
  121. |
  122. */
  123. etag: true,
  124. /*
  125. |--------------------------------------------------------------------------
  126. | Extensions
  127. |--------------------------------------------------------------------------
  128. |
  129. | Set file extension fallbacks. When set, if a file is not found, the given
  130. | extensions will be added to the file name and search for. The first
  131. | that exists will be served. Example: ['html', 'htm'].
  132. |
  133. */
  134. extensions: false
  135. },
  136. locales: {
  137. /*
  138. |--------------------------------------------------------------------------
  139. | Loader
  140. |--------------------------------------------------------------------------
  141. |
  142. | The loader to be used for fetching and updating locales. Below is the
  143. | list of available options.
  144. |
  145. | file, database
  146. |
  147. */
  148. loader: 'file',
  149. /*
  150. |--------------------------------------------------------------------------
  151. | Default Locale
  152. |--------------------------------------------------------------------------
  153. |
  154. | Default locale to be used by Antl provider. You can always switch drivers
  155. | in runtime or use the official Antl middleware to detect the driver
  156. | based on HTTP headers/query string.
  157. |
  158. */
  159. locale: 'en'
  160. },
  161. logger: {
  162. /*
  163. |--------------------------------------------------------------------------
  164. | Transport
  165. |--------------------------------------------------------------------------
  166. |
  167. | Transport to be used for logging messages. You can have multiple
  168. | transports using same driver.
  169. |
  170. | Available drivers are: `file` and `console`.
  171. |
  172. */
  173. transport: 'console',
  174. /*
  175. |--------------------------------------------------------------------------
  176. | Console Transport
  177. |--------------------------------------------------------------------------
  178. |
  179. | Using `console` driver for logging. This driver writes to `stdout`
  180. | and `stderr`
  181. |
  182. */
  183. console: {
  184. driver: 'console',
  185. name: 'adonis-app',
  186. level: 'info'
  187. },
  188. /*
  189. |--------------------------------------------------------------------------
  190. | File Transport
  191. |--------------------------------------------------------------------------
  192. |
  193. | File transport uses file driver and writes log messages for a given
  194. | file inside `tmp` directory for your app.
  195. |
  196. | For a different directory, set an absolute path for the filename.
  197. |
  198. */
  199. file: {
  200. driver: 'file',
  201. name: 'adonis-app',
  202. filename: 'adonis.log',
  203. level: 'info'
  204. }
  205. },
  206. /*
  207. |--------------------------------------------------------------------------
  208. | Generic Cookie Options
  209. |--------------------------------------------------------------------------
  210. |
  211. | The following cookie options are generic settings used by AdonisJs to create
  212. | cookies. However, some parts of the application like `sessions` can have
  213. | seperate settings for cookies inside `config/session.js`.
  214. |
  215. */
  216. cookie: {
  217. httpOnly: true,
  218. sameSite: false,
  219. path: '/',
  220. maxAge: 7200
  221. }
  222. }