mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
parent
c4d69e1a88
commit
5520e311f1
@ -16,6 +16,8 @@ class ImportSourceCoreApi extends ImportSourceHook
|
||||
|
||||
protected $db;
|
||||
|
||||
protected $api;
|
||||
|
||||
public function fetchData()
|
||||
{
|
||||
$func = 'get' . $this->getSetting('object_type') . 'Objects';
|
||||
@ -59,12 +61,12 @@ class ImportSourceCoreApi extends ImportSourceHook
|
||||
|
||||
protected function api()
|
||||
{
|
||||
$apiconfig = Config::module('director')->getSection('api');
|
||||
$client = new RestApiClient($apiconfig->get('address'), $apiconfig->get('port'));
|
||||
$client->setCredentials($apiconfig->get('username'), $apiconfig->get('password'));
|
||||
$api = new CoreApi($client);
|
||||
$api->setDb($this->db());
|
||||
return $api;
|
||||
if ($this->api === null) {
|
||||
$endpoint = $this->db()->getDeploymentEndpoint();
|
||||
$this->api = $endpoint->api();
|
||||
}
|
||||
|
||||
return $this->api;
|
||||
}
|
||||
|
||||
protected function db()
|
||||
|
Loading…
x
Reference in New Issue
Block a user