mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-05-28 04:34:57 -04:00
Simplify backend config
This commit is contained in:
parent
b17986c07e
commit
2d5f858da5
2 changed files with 8 additions and 8 deletions
|
|
@ -18,7 +18,7 @@ class BackendForm extends ConfigForm
|
|||
$this->addElements([
|
||||
[
|
||||
'text',
|
||||
'graphite_web_url',
|
||||
'graphite_url',
|
||||
[
|
||||
'required' => true,
|
||||
'label' => $this->translate('Graphite Web URL'),
|
||||
|
|
@ -28,7 +28,7 @@ class BackendForm extends ConfigForm
|
|||
],
|
||||
[
|
||||
'text',
|
||||
'graphite_web_user',
|
||||
'graphite_user',
|
||||
[
|
||||
'label' => $this->translate('Graphite Web user'),
|
||||
'description' => $this->translate(
|
||||
|
|
@ -39,7 +39,7 @@ class BackendForm extends ConfigForm
|
|||
],
|
||||
[
|
||||
'password',
|
||||
'graphite_web_password',
|
||||
'graphite_password',
|
||||
[
|
||||
'renderPassword' => true,
|
||||
'label' => $this->translate('Graphite Web password'),
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ trait GraphingTrait
|
|||
if (static::$metricsDataSource === null) {
|
||||
$config = Config::module('graphite');
|
||||
$graphite = $config->getSection('graphite');
|
||||
if (! isset($graphite->web_url)) {
|
||||
throw new ConfigurationError('Missing "graphite.web_url" in "%s"', $config->getConfigFile());
|
||||
if (! isset($graphite->url)) {
|
||||
throw new ConfigurationError('Missing "graphite.url" in "%s"', $config->getConfigFile());
|
||||
}
|
||||
|
||||
static::$metricsDataSource = new MetricsDataSource(
|
||||
(new GraphiteWebClient(Url::fromPath($graphite->web_url)))
|
||||
->setUser($graphite->web_user)
|
||||
->setPassword($graphite->web_password)
|
||||
(new GraphiteWebClient(Url::fromPath($graphite->url)))
|
||||
->setUser($graphite->user)
|
||||
->setPassword($graphite->password)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue