mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Updated to latest installer with support for env vars
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user