0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

Setup better media max file-size on devenv

This commit is contained in:
Andrey Antukh 2024-01-10 13:44:00 +01:00 committed by Andrés Moya
parent 77564531eb
commit fede8c9975
5 changed files with 18 additions and 11 deletions

View file

@ -32,6 +32,10 @@ export PENPOT_FLAGS="\
disable-soft-file-schema-validation \ disable-soft-file-schema-validation \
disable-soft-file-validation"; disable-soft-file-validation";
# Setup default upload media file size to 100MiB
export PENPOT_MEDIA_MAX_FILE_SIZE=104857600
# export PENPOT_DATABASE_URI="postgresql://172.17.0.1:5432/penpot" # export PENPOT_DATABASE_URI="postgresql://172.17.0.1:5432/penpot"
# export PENPOT_DATABASE_USERNAME="penpot" # export PENPOT_DATABASE_USERNAME="penpot"
# export PENPOT_DATABASE_PASSWORD="penpot" # export PENPOT_DATABASE_PASSWORD="penpot"

View file

@ -34,6 +34,9 @@ export OPTIONS="
-J-XX:+UnlockDiagnosticVMOptions \ -J-XX:+UnlockDiagnosticVMOptions \
-J-XX:+DebugNonSafepoints" -J-XX:+DebugNonSafepoints"
# Setup default upload media file size to 100MiB
export PENPOT_MEDIA_MAX_FILE_SIZE=104857600
# Setup HEAP # Setup HEAP
# export OPTIONS="$OPTIONS -J-Xms50m -J-Xmx1024m" # export OPTIONS="$OPTIONS -J-Xms50m -J-Xmx1024m"
# export OPTIONS="$OPTIONS -J-Xms1100m -J-Xmx1100m -J-XX:+AlwaysPreTouch" # export OPTIONS="$OPTIONS -J-Xms1100m -J-Xmx1100m -J-XX:+AlwaysPreTouch"

View file

@ -79,6 +79,8 @@
:telemetry-uri "https://telemetry.penpot.app/" :telemetry-uri "https://telemetry.penpot.app/"
:media-max-file-size (* 1024 1024 30) ; 30MiB
:ldap-user-query "(|(uid=:username)(mail=:username))" :ldap-user-query "(|(uid=:username)(mail=:username))"
:ldap-attrs-username "uid" :ldap-attrs-username "uid"
:ldap-attrs-email "mail" :ldap-attrs-email "mail"

View file

@ -32,9 +32,6 @@
org.im4java.core.IMOperation org.im4java.core.IMOperation
org.im4java.core.Info)) org.im4java.core.Info))
(def default-max-file-size
(* 1024 1024 30)) ; 30 MiB
(s/def ::path fs/path?) (s/def ::path fs/path?)
(s/def ::filename string?) (s/def ::filename string?)
(s/def ::size integer?) (s/def ::size integer?)
@ -83,13 +80,14 @@
(defn validate-media-size! (defn validate-media-size!
[upload] [upload]
(when (> (:size upload) (cf/get :media-max-file-size default-max-file-size)) (let [max-size (cf/get :media-max-file-size)]
(ex/raise :type :restriction (when (> (:size upload) max-size)
:code :media-max-file-size-reached (ex/raise :type :restriction
:hint (str/ffmt "the uploaded file size % is greater than the maximum %" :code :media-max-file-size-reached
(:size upload) :hint (str/ffmt "the uploaded file size % is greater than the maximum %"
default-max-file-size))) (:size upload)
upload) max-size)))
upload))
(defmulti process :cmd) (defmulti process :cmd)
(defmulti process-error class) (defmulti process-error class)

View file

@ -49,7 +49,7 @@ http {
listen 3449 default_server; listen 3449 default_server;
server_name _; server_name _;
client_max_body_size 30M; client_max_body_size 100M;
charset utf-8; charset utf-8;
proxy_http_version 1.1; proxy_http_version 1.1;