Skip to content

Commit

Permalink
Fix kernel always reboot strategy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiraux Héléna authored and Baldinof committed Jan 16, 2022
1 parent 4b6ca3e commit a5b3f36
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/DependencyInjection/BaldinofRoadRunnerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Baldinof\RoadRunnerBundle\Integration\Sentry\SentryListener;
use Baldinof\RoadRunnerBundle\Integration\Sentry\SentryMiddleware;
use Baldinof\RoadRunnerBundle\Integration\Symfony\ConfigureVarDumperListener;
use Baldinof\RoadRunnerBundle\Reboot\AlwaysRebootStrategy;
use Baldinof\RoadRunnerBundle\Reboot\KernelRebootStrategyInterface;
use Baldinof\RoadRunnerBundle\Reboot\OnExceptionRebootStrategy;
use Doctrine\Persistence\ManagerRegistry;
Expand Down Expand Up @@ -48,11 +49,18 @@ public function load(array $configs, ContainerBuilder $container): void
$this->loadDebug($container);
}

$container->register(KernelRebootStrategyInterface::class, OnExceptionRebootStrategy::class)
->addArgument($config['kernel_reboot']['allowed_exceptions'])
->addArgument(new Reference(LoggerInterface::class))
->setAutoconfigured(true)
->addTag('monolog.logger', ['channel' => self::MONOLOG_CHANNEL]);
if ($config['kernel_reboot']['strategy'] === Configuration::KERNEL_REBOOT_STRATEGY_ALWAYS) {
$container
->register(KernelRebootStrategyInterface::class, AlwaysRebootStrategy::class)
->setAutoconfigured(true);
} else {
$container
->register(KernelRebootStrategyInterface::class, OnExceptionRebootStrategy::class)
->addArgument($config['kernel_reboot']['allowed_exceptions'])
->addArgument(new Reference(LoggerInterface::class))
->setAutoconfigured(true)
->addTag('monolog.logger', ['channel' => self::MONOLOG_CHANNEL]);
}

$container->setParameter('baldinof_road_runner.middlewares', $config['middlewares']);

Expand Down

0 comments on commit a5b3f36

Please sign in to comment.