ActionController::backend(): Add condition to check which backend should be used

- If both are available
This commit is contained in:
Sukhwinder Dhillon 2023-11-21 13:07:16 +01:00
parent f52d05de31
commit 4ef7f5664a
1 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ use Icinga\Exception\ProgrammingError;
use Icinga\Module\Director\Integration\Icingadb\IcingadbBackend;
use Icinga\Module\Director\Integration\BackendInterface;
use Icinga\Module\Director\Integration\MonitoringModule\Monitoring;
use Icinga\Module\Director\ProvidedHook\Icingadb\IcingadbSupport;
use Icinga\Module\Director\Web\Controller\Extension\CoreApi;
use Icinga\Module\Director\Web\Controller\Extension\DirectorDb;
use Icinga\Module\Director\Web\Controller\Extension\RestApi;
@ -248,7 +249,7 @@ abstract class ActionController extends Controller implements ControlsAndContent
protected function backend(): BackendInterface
{
if ($this->backend === null) {
if (Module::exists('icingadb')) {
if (Module::exists('icingadb') && IcingadbSupport::useIcingaDbAsBackend()) {
$this->backend = new IcingadbBackend();
} else {
$this->backend = new Monitoring($this->getAuth());