Skip to content

Commit

Permalink
add MAX_UPLOAD_SIZE and MAX_UPLOAD_TIME into php env
Browse files Browse the repository at this point in the history
so it can get to api/v2/import and then to JS
see elabftw/elabftw#5232
  • Loading branch information
NicolasCARPi committed Sep 9, 2024
1 parent 313ca5d commit 8ad3638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/entrypoint/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ getEnv() {
unset SECRET_KEY
max_php_memory=${MAX_PHP_MEMORY:-2G}
max_upload_size=${MAX_UPLOAD_SIZE:-100M}
max_upload_time=${MAX_UPLOAD_TIME:-900000}
# CIS benchmark nginx 2.0.0 2.4.3
keepalive_timeout=${KEEPALIVE_TIMEOUT:-10s}
php_timezone=${PHP_TIMEZONE:-Europe/Paris}
Expand Down Expand Up @@ -354,6 +355,8 @@ populatePhpEnv() {
sed -i -e "/%DB_CERT_PATH%/d" /etc/php83/php-fpm.d/elabpool.conf
fi
sed -i -e "s/%SECRET_KEY%/${secret_key}/" /etc/php83/php-fpm.d/elabpool.conf
sed -i -e "s/%MAX_UPLOAD_SIZE%/${max_upload_size}/" /etc/php83/php-fpm.d/elabpool.conf
sed -i -e "s/%MAX_UPLOAD_TIME%/${max_upload_time}/" /etc/php83/php-fpm.d/elabpool.conf
# use # as separator instead of slash
sed -i -e "s#%SITE_URL%#${site_url}#" /etc/php83/php-fpm.d/elabpool.conf
# assume that if ak is set, then sk is too
Expand All @@ -376,6 +379,8 @@ populateBashEnv() {
export DB_USER='${db_user}'
export DB_PASSWORD='${db_password}'
export DB_CERT_PATH='${db_cert_path}'
export MAX_UPLOAD_SIZE='${max_upload_size}'
export MAX_UPLOAD_TIME='${max_upload_time}'
export SECRET_KEY='${secret_key}'
export SITE_URL='${site_url}'
export ELAB_AWS_ACCESS_KEY='${aws_ak}'
Expand Down
2 changes: 2 additions & 0 deletions src/php/elabpool.conf
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ env[DB_NAME] = "%DB_NAME%"
env[DB_USER] = "%DB_USER%"
env[DB_PASSWORD] = "%DB_PASSWORD%"
env[DB_CERT_PATH] = "%DB_CERT_PATH%"
env[MAX_UPLOAD_SIZE] = "%MAX_UPLOAD_SIZE%"
env[MAX_UPLOAD_TIME] = "%MAX_UPLOAD_TIME%"
env[SECRET_KEY] = "%SECRET_KEY%"
env[SITE_URL] = "%SITE_URL%"
env[ELAB_AWS_ACCESS_KEY] = "%ELAB_AWS_ACCESS_KEY%"
Expand Down

0 comments on commit 8ad3638

Please sign in to comment.