mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Load resources from config automatically instead of throwing an exception
fixes #10918
This commit is contained in:
parent
9d5e21e71e
commit
e4a0678df0
@ -520,25 +520,6 @@ abstract class ApplicationBootstrap
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the resource factory
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function setupResourceFactory()
|
||||
{
|
||||
try {
|
||||
$config = Config::app('resources');
|
||||
ResourceFactory::setConfig($config);
|
||||
} catch (NotReadableError $e) {
|
||||
Logger::error(
|
||||
new IcingaException('Cannot load resource configuration. An exception was thrown:', $e)
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the user backend factory
|
||||
*
|
||||
|
@ -41,7 +41,6 @@ class Cli extends ApplicationBootstrap
|
||||
->setupInternationalization()
|
||||
->parseBasicParams()
|
||||
->setupLogger()
|
||||
->setupResourceFactory()
|
||||
->setupModuleManager()
|
||||
->setupUserBackendFactory()
|
||||
->loadSetupModuleIfNecessary();
|
||||
|
@ -82,7 +82,6 @@ class Web extends EmbeddedWeb
|
||||
->setupLogging()
|
||||
->setupErrorHandling()
|
||||
->loadConfig()
|
||||
->setupResourceFactory()
|
||||
->setupSession()
|
||||
->setupNotifications()
|
||||
->setupRequest()
|
||||
|
@ -67,16 +67,14 @@ class ResourceFactory implements ConfigAwareFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the existing resources are set. If not, throw an error.
|
||||
* Check if the existing resources are set. If not, load them from resources.ini
|
||||
*
|
||||
* @throws ConfigurationError
|
||||
*/
|
||||
private static function assertResourcesExist()
|
||||
{
|
||||
if (self::$resources === null) {
|
||||
throw new ConfigurationError(
|
||||
'Resources not set up. Please contact your Icinga Web administrator'
|
||||
);
|
||||
self::$resources = Config::app('resources');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user