diff --git a/composer.json b/composer.json index 7901dde3..41389109 100644 --- a/composer.json +++ b/composer.json @@ -48,10 +48,10 @@ "pugx/shortid-php": "^1.0", "ramsey/uuid": "^4.2", "shlinkio/shlink-common": "dev-main#cbcff58 as 4.4", - "shlinkio/shlink-config": "^1.5", + "shlinkio/shlink-config": "dev-main#483cf8a as 1.6", "shlinkio/shlink-event-dispatcher": "^2.3", "shlinkio/shlink-importer": "^2.5", - "shlinkio/shlink-installer": "dev-develop#ba32503 as 7.0", + "shlinkio/shlink-installer": "dev-develop#3ca7ec5 as 7.0", "shlinkio/shlink-ip-geolocation": "^2.2", "symfony/console": "^6.0", "symfony/filesystem": "^6.0", diff --git a/config/config.php b/config/config.php index 33cf602b..0adb0208 100644 --- a/config/config.php +++ b/config/config.php @@ -9,10 +9,10 @@ use Laminas\Diactoros; use Mezzio; use Mezzio\ProblemDetails; use Mezzio\Swoole; +use Shlinkio\Shlink\Config\ConfigAggregator\EnvVarLoaderProvider; use function class_exists; use function Shlinkio\Shlink\Config\env; -use function Shlinkio\Shlink\Core\putNotYetDefinedEnv; use const PHP_SAPI; @@ -21,15 +21,7 @@ $isTestEnv = env('APP_ENV') === 'test'; return (new ConfigAggregator\ConfigAggregator([ ! $isTestEnv - ? new ConfigAggregator\ArrayProvider((new ConfigAggregator\ConfigAggregator([ - new ConfigAggregator\PhpFileProvider('config/params/generated_config.php'), - ], null, [function (array $generatedConfig) { - foreach ($generatedConfig as $envVar => $value) { - putNotYetDefinedEnv($envVar, $value); - } - - return []; - }]))->getMergedConfig()) + ? new EnvVarLoaderProvider('config/params/generated_config.php') : new ConfigAggregator\ArrayProvider([]), Mezzio\ConfigProvider::class, Mezzio\Router\ConfigProvider::class, diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 870f84c4..567fde47 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -13,13 +13,9 @@ use PUGX\Shortid\Factory as ShortIdFactory; use Shlinkio\Shlink\Common\Util\DateRange; use function Functional\reduce_left; -use function implode; use function is_array; -use function is_scalar; use function print_r; -use function putenv; use function Shlinkio\Shlink\Common\buildDateRange; -use function Shlinkio\Shlink\Config\env; use function sprintf; use function str_repeat; @@ -120,18 +116,3 @@ function fieldWithUtf8Charset(FieldBuilder $field, array $emConfig, string $coll default => $field, }; } - -function putNotYetDefinedEnv(string $key, mixed $value): void -{ - $isArray = is_array($value); - if (!($isArray || is_scalar($value)) || env($key) !== null) { - return; - } - - $normalizedValue = $isArray ? implode(',', $value) : match ($value) { - true => 'true', - false => 'false', - default => $value, - }; - putenv(sprintf('%s=%s', $key, $normalizedValue)); -}