Skip to content

Commit

Permalink
entrypoint: enable configuring PHP memory limit
Browse files Browse the repository at this point in the history
Adds an environment variable, PHP_MEMORY_LIMIT, which overrides the default memory limit as shipped by PHP.

Closes #124
  • Loading branch information
Maffsie authored Aug 28, 2023
1 parent b340aae commit 5ca0ac8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions root/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ provisioner() {
SYMFONY__ENV__DATABASE_DRIVER=${SYMFONY__ENV__DATABASE_DRIVER:-pdo_sqlite}
POPULATE_DATABASE=${POPULATE_DATABASE:-True}

# PHP configuration base and memory limit (default is 128M because that's what php.ini currently ships with)
PHP_CONF_BASE_DIR=`php --ini | head -n1 | sed 's/^.*: //'`
PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-128M}

# Replace environment variables
envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml

# Configure PHP memory limit
sed -i "s/memory_limit\s*=.*/memory_limit=${PHP_MEMORY_LIMIT}/g" $PHP_CONF_BASE_DIR/php.ini

# Wait for external database
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] || [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] ; then
wait_for_database
Expand Down

0 comments on commit 5ca0ac8

Please sign in to comment.