diff --git a/CHANGELOG.md b/CHANGELOG.md index 0696a389..a350897f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* [#2208](https://github.com/shlinkio/shlink/issues/2208) Explicitly promote installer config options as env vars, instead of as a side effect of loading the app config. + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [4.2.1] - 2024-10-04 ### Added * [#2183](https://github.com/shlinkio/shlink/issues/2183) Redis database index to be used can now be specified in the connection URI path, and Shlink will honor it. diff --git a/composer.json b/composer.json index 77fc84a8..5f7078df 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "ramsey/uuid": "^4.7", "shlinkio/doctrine-specification": "^2.1.1", "shlinkio/shlink-common": "^6.3", - "shlinkio/shlink-config": "^3.0", + "shlinkio/shlink-config": "dev-main#76a96ee as 3.1", "shlinkio/shlink-event-dispatcher": "^4.1", "shlinkio/shlink-importer": "^5.3.2", "shlinkio/shlink-installer": "^9.2", diff --git a/config/config.php b/config/config.php index 78fc542a..40f88ea3 100644 --- a/config/config.php +++ b/config/config.php @@ -8,18 +8,13 @@ use Laminas\ConfigAggregator; use Laminas\Diactoros; use Mezzio; use Mezzio\ProblemDetails; -use Shlinkio\Shlink\Config\ConfigAggregator\EnvVarLoaderProvider; use function Shlinkio\Shlink\Config\env; -use function Shlinkio\Shlink\Core\enumValues; $isTestEnv = env('APP_ENV') === 'test'; return (new ConfigAggregator\ConfigAggregator( providers: [ - ! $isTestEnv - ? new EnvVarLoaderProvider('config/params/generated_config.php', enumValues(Core\Config\EnvVars::class)) - : new ConfigAggregator\ArrayProvider([]), Mezzio\ConfigProvider::class, Mezzio\Router\ConfigProvider::class, Mezzio\Router\FastRouteRouter\ConfigProvider::class, diff --git a/config/container.php b/config/container.php index 6e5172a4..13d64353 100644 --- a/config/container.php +++ b/config/container.php @@ -6,13 +6,20 @@ use Laminas\ServiceManager\ServiceManager; use Shlinkio\Shlink\Core\Config\EnvVars; use Symfony\Component\Lock; +use function Shlinkio\Shlink\Config\loadEnvVarsFromConfig; +use function Shlinkio\Shlink\Core\enumValues; + use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY; chdir(dirname(__DIR__)); require 'vendor/autoload.php'; -// This is one of the first files loaded. Configure the timezone here +// Promote env vars from installer config +loadEnvVarsFromConfig('config/params/generated_config.php', enumValues(EnvVars::class)); + +// This is one of the first files loaded. Configure the timezone and memory limit here +ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv('512M')); date_default_timezone_set(EnvVars::TIMEZONE->loadFromEnv(date_default_timezone_get())); // This class alias tricks the ConfigAbstractFactory to return Lock\Factory instances even with a different service name @@ -23,10 +30,6 @@ if (! class_exists(LOCAL_LOCK_FACTORY)) { return (static function (): ServiceManager { $config = require __DIR__ . '/config.php'; - - // Set memory limit right after loading config, to ensure installer config has been promoted as env vars - ini_set('memory_limit', EnvVars::MEMORY_LIMIT->loadFromEnv('512M')); - $container = new ServiceManager($config['dependencies']); $container->setService('config', $config);