Skip to content

Commit

Permalink
Added options for setting upload limits
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaburke91 committed May 23, 2023
1 parent 2e1656e commit c9a0e8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
const axios = require("axios")
const { ApplicationError } = require("@strapi/utils").errors

const DEFAULT_UPLOAD_LIMIT_MB = 200

module.exports = {
init({ api_key, storage_zone, pull_zone }) {
init({ api_key, storage_zone, pull_zone, max_content_length, max_body_length }) {
if (!api_key || !storage_zone || !pull_zone) {
throw new ApplicationError("BUNNY_API_KEY, BUNNY_STORAGE_ZONE or BUNNY_PULL_ZONE can't be null or undefined.")
}
Expand All @@ -16,6 +18,8 @@ module.exports = {
AccessKey: api_key,
"content-type": "application/octet-stream",
},
maxContentLength: max_content_length || (1024 * 1024 * DEFAULT_UPLOAD_LIMIT_MB),
maxBodyLength: max_body_length || (1024 * 1024 * DEFAULT_UPLOAD_LIMIT_MB)
})

const upload = (file) =>
Expand Down

0 comments on commit c9a0e8b

Please sign in to comment.