mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Updated to latest shlink-installer and shlink-config, ensuring env vars are properly loaded
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user