Updated to latest installer with support for env vars

This commit is contained in:
Alejandro Celaya
2022-01-15 11:34:17 +01:00
parent 0d37eb65c9
commit c6f16b0558
6 changed files with 45 additions and 13 deletions

View File

@@ -12,12 +12,25 @@ use Mezzio\Swoole;
use function class_exists;
use function Shlinkio\Shlink\Config\env;
use function Shlinkio\Shlink\Core\putNotYetDefinedEnv;
use const PHP_SAPI;
$isCli = PHP_SAPI === 'cli';
$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 ConfigAggregator\ArrayProvider([]),
Mezzio\ConfigProvider::class,
Mezzio\Router\ConfigProvider::class,
Mezzio\Router\FastRouteRouter\ConfigProvider::class,
@@ -35,9 +48,9 @@ return (new ConfigAggregator\ConfigAggregator([
CLI\ConfigProvider::class,
Rest\ConfigProvider::class,
new ConfigAggregator\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
env('APP_ENV') === 'test'
$isTestEnv
? new ConfigAggregator\PhpFileProvider('config/test/*.global.php')
: new ConfigAggregator\PhpFileProvider('config/params/generated_config.php'),
: new ConfigAggregator\ArrayProvider([]),
], 'data/cache/app_config.php', [
Core\Config\BasePathPrefixer::class,
]))->getMergedConfig();