diff --git a/forge/config.js b/forge/config.js index e0e5487..d1d832c 100644 --- a/forge/config.js +++ b/forge/config.js @@ -2,6 +2,7 @@ const fs = require('fs') const fp = require('fastify-plugin') const path = require('path') +const xbytes = require('xbytes') const YAML = require('yaml') module.exports = fp(async function (app, opts, next) { @@ -86,6 +87,16 @@ module.exports = fp(async function (app, opts, next) { config.logging.http = 'warn' } } + + if (config.driver?.quota) { + const parsed = xbytes.parse(config.driver.quota) + config.driver.quota = parsed.bytes + } + + if (config.context?.quota) { + const parsed = xbytes.parse(config.context.quota) + config.context.quota = parsed.bytes + } Object.freeze(config) app.decorate('config', config) diff --git a/package.json b/package.json index e82fc09..572479c 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "semver": "^7.3.8", "sequelize": "^6.25.3", "sqlite3": "^5.1.2", + "xbytes": "^1.8.0", "yaml": "^2.1.3" }, "devDependencies": {