Skip to content

Commit

Permalink
Merge pull request #2092 from acelaya-forks/customizable-memory-limit
Browse files Browse the repository at this point in the history
Allow memory_limit to be configurable
  • Loading branch information
acelaya authored Apr 9, 2024
2 parents 75f6f8d + 5e74dd7 commit 5e83f30
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this

This allows for a better traceability, as the logs generated during those jobs will have a matching UUID as the logs generated during the request the triggered the job.

* [#2087](https://github.com/shlinkio/shlink/issues/2087) Allow `memory_limit` to be configured via the new `MEMORY_LIMIT` env var or configuration option.

### Deprecated
* *Nothing*

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"shlinkio/shlink-config": "^3.0",
"shlinkio/shlink-event-dispatcher": "dev-main#a2a5d6f as 4.1",
"shlinkio/shlink-importer": "^5.3.1",
"shlinkio/shlink-installer": "^9.0",
"shlinkio/shlink-installer": "dev-develop#164e23d as 9.1",
"shlinkio/shlink-ip-geolocation": "^4.0",
"shlinkio/shlink-json": "^1.1",
"spiral/roadrunner": "^2023.3",
Expand Down
1 change: 1 addition & 0 deletions config/autoload/installer.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'installer' => [
'enabled_options' => [
Option\Server\RuntimeConfigOption::class,
Option\Server\MemoryLimitConfigOption::class,
Option\Database\DatabaseDriverConfigOption::class,
Option\Database\DatabaseNameConfigOption::class,
Option\Database\DatabaseHostConfigOption::class,
Expand Down
2 changes: 2 additions & 0 deletions config/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

require 'vendor/autoload.php';

// Set a default memory limit, but allow custom values
ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv('512M'));
// This is one of the first files loaded. Configure the timezone here
date_default_timezone_set(EnvVars::TIMEZONE->loadFromEnv(date_default_timezone_get()));

Expand Down
1 change: 0 additions & 1 deletion data/infra/php.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
display_errors=On
error_reporting=-1
memory_limit=-1
log_errors_max_len=0
zend.assertions=1
assert.exception=1
Expand Down
1 change: 0 additions & 1 deletion docker/config/php.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
log_errors_max_len=0
zend.assertions=1
assert.exception=1
memory_limit=512M
1 change: 1 addition & 0 deletions module/Core/src/Config/EnvVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ enum EnvVars: string
case REDIRECT_APPEND_EXTRA_PATH = 'REDIRECT_APPEND_EXTRA_PATH';
case TIMEZONE = 'TIMEZONE';
case MULTI_SEGMENT_SLUGS_ENABLED = 'MULTI_SEGMENT_SLUGS_ENABLED';
case MEMORY_LIMIT = 'MEMORY_LIMIT';

public function loadFromEnv(mixed $default = null): mixed
{
Expand Down

0 comments on commit 5e83f30

Please sign in to comment.