@nitra/fastify 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -4
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nitra/fastify",
3
3
  "description": "Fastify helper",
4
- "version": "1.5.0",
4
+ "version": "1.5.2",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
7
  "files": [
package/src/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import fastify from 'fastify'
2
2
  import fastifySensible from '@fastify/sensible'
3
3
  import getLogger from '@nitra/bunyan/trace'
4
- import { exit } from 'node:process'
4
+ import { exit, env } from 'node:process'
5
5
 
6
- const port = Number(process.env.PORT) || 8080
6
+ const port = Number(env.PORT) || 8080
7
7
 
8
8
  export const app = fastify({
9
9
  // logger: isDev,
10
- http2: !!process.env.K_SERVICE // Запускаємо з http2 якщо в Cloud Run
10
+ bodyLimit: (process.env.BODY_LIMIT_MB || 1) * 1024 * 1024,
11
+ http2: !!env.K_SERVICE // Запускаємо з http2 якщо в Cloud Run
11
12
  })
12
13
 
13
14
  app.register(fastifySensible) // для reply.badRequest(`Not found url: ${req.url} ...`)
@@ -46,7 +47,7 @@ export function listen() {
46
47
  }
47
48
 
48
49
  function setHeaders(req, reply) {
49
- let host = process.env.ORIGIN || req.headers.origin || req.headers.referer
50
+ let host = env.ORIGIN || req.headers.origin || req.headers.referer
50
51
  if (!host) {
51
52
  host = 'localhost'
52
53
  }