From f3ab8af4312a58e7571ca5ca5222b31fd852b8e0 Mon Sep 17 00:00:00 2001 From: Baldinof Date: Sun, 16 Jan 2022 19:31:12 +0100 Subject: [PATCH] Allow to configure custom reboot strategy --- src/DependencyInjection/BaldinofRoadRunnerExtension.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DependencyInjection/BaldinofRoadRunnerExtension.php b/src/DependencyInjection/BaldinofRoadRunnerExtension.php index b74d2c9..ab5aac6 100644 --- a/src/DependencyInjection/BaldinofRoadRunnerExtension.php +++ b/src/DependencyInjection/BaldinofRoadRunnerExtension.php @@ -53,13 +53,15 @@ public function load(array $configs, ContainerBuilder $container): void $container ->register(KernelRebootStrategyInterface::class, AlwaysRebootStrategy::class) ->setAutoconfigured(true); - } else { + } elseif ($config['kernel_reboot']['strategy'] === Configuration::KERNEL_REBOOT_STRATEGY_ON_EXCEPTION) { $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]); + } else { + $container->setAlias(KernelRebootStrategyInterface::class, $config['kernel_reboot']['strategy']); } $container->setParameter('baldinof_road_runner.middlewares', $config['middlewares']);