Default configDir in App bootstrap related to last commit

This commit is contained in:
Thomas Gelf 2014-04-17 17:01:23 +00:00
parent 5fdec39475
commit 6f9c187d47
1 changed files with 11 additions and 3 deletions

View File

@ -124,7 +124,7 @@ abstract class ApplicationBootstrap
/** /**
* Constructor * Constructor
*/ */
protected function __construct($configDir) protected function __construct($configDir = null)
{ {
$this->libDir = realpath(__DIR__ . '/../..'); $this->libDir = realpath(__DIR__ . '/../..');
@ -139,13 +139,21 @@ abstract class ApplicationBootstrap
define('ICINGA_APPDIR', $this->appDir); define('ICINGA_APPDIR', $this->appDir);
} }
if ($configDir === null) {
if (array_key_exists('ICINGAWEB_CONFIGDIR', $_SERVER)) {
$configDir = $_SERVER['ICINGAWEB_CONFIGDIR'];
} else {
$configDir = '/etc/icingaweb';
}
}
$this->configDir = realpath($configDir);
$this->setupAutoloader(); $this->setupAutoloader();
$this->setupZendAutoloader(); $this->setupZendAutoloader();
Benchmark::measure('Bootstrap, autoloader registered'); Benchmark::measure('Bootstrap, autoloader registered');
Icinga::setApp($this); Icinga::setApp($this);
$this->configDir = realpath($configDir);
require_once dirname(__FILE__) . '/functions.php'; require_once dirname(__FILE__) . '/functions.php';
} }
@ -269,7 +277,7 @@ abstract class ApplicationBootstrap
* *
* @return ApplicationBootstrap * @return ApplicationBootstrap
*/ */
public static function start($configDir) public static function start($configDir = null)
{ {
$application = new static($configDir); $application = new static($configDir);
$application->bootstrap(); $application->bootstrap();