-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKernel.php
More file actions
47 lines (36 loc) · 1.62 KB
/
Kernel.php
File metadata and controls
47 lines (36 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace CodedMonkey\Dirigent;
use CodedMonkey\Dirigent\DependencyInjection\Compiler\EncryptionPass;
use CodedMonkey\Dirigent\DependencyInjection\DirigentExtension;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
public const VERSION = '0.5.x-dev';
protected function configureContainer(ContainerConfigurator $container): void
{
$configDir = $this->getConfigDir();
$container->import($configDir . '/packages/*.yaml');
$container->import($configDir . '/services.yaml');
$container->import($configDir . '/dirigent.{json,php,yml,yaml}');
if (isset($_SERVER['DIRIGENT_IMAGE'])) {
$container->import('/srv/config/*.{json,php,yml,yaml}');
}
}
protected function build(ContainerBuilder $container): void
{
$container->registerExtension(new DirigentExtension());
// The encryption pass has to be the first pass to run as it removes sensitive data from the container
$container->addCompilerPass(new EncryptionPass(), priority: 2048);
}
public function boot(): void
{
parent::boot();
// Set Composer env vars
$_SERVER['COMPOSER_CACHE_DIR'] = $this->container->getParameter('dirigent.storage.path') . '/composer-cache';
$_SERVER['COMPOSER_HOME'] = $this->container->getParameter('dirigent.storage.path') . '/composer';
}
}