This commit is contained in:
@kirill.komarov
2026-05-10 17:15:56 +05:00
parent e67d8bdc0a
commit 517cd23a55
17 changed files with 151 additions and 37 deletions
+6 -2
View File
@@ -6,6 +6,7 @@ import multipart from '@fastify/multipart'
import fastifyStatic from '@fastify/static'
import path from 'node:path'
import { ensureAdminUser } from './lib/bootstrap-admin.js'
import { getMaxUploadBodyBytes, getProductImageMaxFileBytes } from './lib/upload-limits.js'
import { registerAuth } from './plugins/auth.js'
import { registerApiRoutes } from './routes/api.js'
import { registerAuthRoutes } from './routes/auth.js'
@@ -17,7 +18,10 @@ const origin = (process.env.CORS_ORIGIN ?? '')
.map((s) => s.trim())
.filter(Boolean)
const fastify = Fastify({ logger: true })
const fastify = Fastify({
logger: true,
bodyLimit: getMaxUploadBodyBytes(),
})
await fastify.register(cors, {
origin: origin.length ? origin : true,
@@ -31,7 +35,7 @@ await fastify.register(jwt, {
await fastify.register(multipart, {
limits: {
files: 10,
fileSize: 10 * 1024 * 1024,
fileSize: getProductImageMaxFileBytes(),
},
})