92 lines
2.9 KiB
PHP
92 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Laminas\ConfigAggregator\ArrayProvider;
|
|
use Laminas\ConfigAggregator\ConfigAggregator;
|
|
use Laminas\ConfigAggregator\PhpFileProvider;
|
|
|
|
// To enable or disable caching, set the `ConfigAggregator::ENABLE_CACHE` boolean in
|
|
// `config/autoload/local.php`.
|
|
$cacheConfig = [
|
|
'config_cache_path' => 'data/cache/config-cache.php',
|
|
];
|
|
|
|
$aggregator = new ConfigAggregator([
|
|
// Include cache configuration
|
|
new ArrayProvider($cacheConfig),
|
|
\Mezzio\Helper\ConfigProvider::class,
|
|
\Mezzio\ConfigProvider::class,
|
|
\Mezzio\Router\ConfigProvider::class,
|
|
\Mezzio\Router\LaminasRouter\ConfigProvider::class,
|
|
|
|
\Laminas\Diactoros\ConfigProvider::class,
|
|
\Laminas\HttpHandlerRunner\ConfigProvider::class,
|
|
\Laminas\Validator\ConfigProvider::class,
|
|
\Laminas\Router\ConfigProvider::class,
|
|
|
|
\Reinfi\DependencyInjection\ConfigProvider::class,
|
|
|
|
\DoctrineORMModule\ConfigProvider::class,
|
|
\DoctrineModule\ConfigProvider::class,
|
|
|
|
|
|
// Swoole config to overwrite some services (if installed)
|
|
class_exists(\Mezzio\Swoole\ConfigProvider::class)
|
|
? \Mezzio\Swoole\ConfigProvider::class
|
|
: function (): array {
|
|
return [];
|
|
},
|
|
|
|
|
|
// Data
|
|
\MyTube\Data\Business\ConfigProvider::class,
|
|
\MyTube\Data\Log\ConfigProvider::class,
|
|
|
|
// Infrastructure
|
|
\MyTube\Infrastructure\Database\ConfigProvider::class,
|
|
\MyTube\Infrastructure\DependencyInjection\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Encryption\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Exception\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Logging\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Rbac\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Request\ConfigProvider::class,
|
|
\MyTube\Infrastructure\Session\ConfigProvider::class,
|
|
|
|
// HandlingDomain
|
|
\MyTube\Handling\User\ConfigProvider::class,
|
|
\MyTube\Handling\UserSession\ConfigProvider::class,
|
|
\MyTube\Handling\Registration\ConfigProvider::class,
|
|
\MyTube\Handling\Video\ConfigProvider::class,
|
|
|
|
// API
|
|
/// Command
|
|
\MyTube\API\Console\ConfigProvider::class,
|
|
|
|
/// External
|
|
\MyTube\API\External\Health\ConfigProvider::class,
|
|
\MyTube\API\External\User\ConfigProvider::class,
|
|
\MyTube\API\External\Authentication\ConfigProvider::class,
|
|
\MyTube\API\External\Video\ConfigProvider::class,
|
|
|
|
/// Internal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load application config in a pre-defined order in such a way that local settings
|
|
// overwrite global settings. (Loaded as first to last):
|
|
// - `global.php`
|
|
// - `*.global.php`
|
|
// - `local.php`
|
|
// - `*.local.php`
|
|
new PhpFileProvider(realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php'),
|
|
|
|
// Load development config if it exists
|
|
new PhpFileProvider(realpath(__DIR__) . '/development.config.php'),
|
|
], $cacheConfig['config_cache_path']);
|
|
|
|
return $aggregator->getMergedConfig();
|