mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-22 21:54:15 +02:00
Load all files in the config directory and enable container compilation
This commit is contained in:
16
index.php
16
index.php
@@ -12,12 +12,18 @@ ini_set('open_basedir', __DIR__);
|
||||
// Initialize environment variable handler
|
||||
Dotenv::createUnsafeImmutable(__DIR__)->safeLoad();
|
||||
|
||||
// Initialize the container
|
||||
$container = call_user_func_array(
|
||||
[new ContainerBuilder, 'addDefinitions'],
|
||||
glob(__DIR__ . '/app/config/*.php')
|
||||
);
|
||||
|
||||
if (filter_var(getenv('APP_DEBUG'), FILTER_VALIDATE_BOOLEAN) !== true) {
|
||||
$container->enableCompilation(__DIR__ . '/app/cache');
|
||||
}
|
||||
|
||||
// Initialize the application
|
||||
$app = (new ContainerBuilder)->addDefinitions(
|
||||
__DIR__ . '/app/config/cache.php',
|
||||
__DIR__ . '/app/config/app.php',
|
||||
__DIR__ . '/app/config/container.php'
|
||||
)->build()->call(AppManager::class);
|
||||
$app = $container->build()->call(AppManager::class);
|
||||
|
||||
// Engage!
|
||||
$app->run();
|
||||
|
@@ -29,10 +29,9 @@ class TestCase extends PHPUnitTestCase
|
||||
{
|
||||
Dotenv::createUnsafeImmutable(__DIR__)->safeLoad();
|
||||
|
||||
$this->container = (new ContainerBuilder)->addDefinitions(
|
||||
dirname(__DIR__) . '/app/config/cache.php',
|
||||
dirname(__DIR__) . '/app/config/app.php',
|
||||
dirname(__DIR__) . '/app/config/container.php'
|
||||
$this->container = call_user_func_array(
|
||||
[new ContainerBuilder, 'addDefinitions'],
|
||||
glob(dirname(__DIR__) . '/app/config/*.php')
|
||||
)->build();
|
||||
|
||||
$this->cache = new ArrayAdapter($this->container->get('cache_lifetime'));
|
||||
|
Reference in New Issue
Block a user