diff --git a/lib/main.js b/lib/main.js index e0a53c6..13cfc9c 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,8 +16,11 @@ import * as utils from './utils.js'; * @property {import('@eik/sink').default} [sink] * @property {import('pino').Logger} [logger] * @property {import('@eik/sink').default} [customSink] [Deprecated] Use sink instead + * @property {number} [aliasCacheControl] * @property {string} [aliasCacheControl] * @property {string} [notFoundCacheControl="public, max-age=5"] + * @property {number} [pkgMaxFileSize=10000000] The limit in bytes before PUT /pkg/ starts returning 413 Content Too Large + * @property {number} [mapMaxFileSize=1000000] The limit in bytes before PUT /map/ starts returning 413 Content Too Large */ const EikService = class EikService { @@ -26,7 +29,13 @@ const EikService = class EikService { */ constructor(options = {}) { let { sink, logger } = options; - const { customSink, notFoundCacheControl, aliasCacheControl } = options; + const { + customSink, + notFoundCacheControl, + aliasCacheControl, + pkgMaxFileSize, + mapMaxFileSize, + } = options; this._notFoundCacheControl = notFoundCacheControl || 'public, max-age=5'; @@ -90,9 +99,19 @@ const EikService = class EikService { }); this._pkgLog = new eik.http.PkgLog({ organizations, sink, logger }); this._pkgGet = new eik.http.PkgGet({ organizations, sink, logger }); - this._pkgPut = new eik.http.PkgPut({ organizations, sink, logger }); + this._pkgPut = new eik.http.PkgPut({ + organizations, + sink, + logger, + pkgMaxFileSize, + }); this._mapGet = new eik.http.MapGet({ organizations, sink, logger }); - this._mapPut = new eik.http.MapPut({ organizations, sink, logger }); + this._mapPut = new eik.http.MapPut({ + organizations, + sink, + logger, + mapMaxFileSize, + }); const mergeStreams = (...streams) => { const str = new PassThrough({ objectMode: true });