mirror of
https://github.com/openvk/chandler.git
synced 2024-11-14 19:19:11 +03:00
Allow multiple config locations
This commit is contained in:
parent
8aa46425b5
commit
d0123f79db
1 changed files with 11 additions and 1 deletions
|
@ -4,7 +4,6 @@ use Tracy\Debugger;
|
|||
|
||||
define("CHANDLER_VER", "0.0.1", false);
|
||||
define("CHANDLER_ROOT", dirname(__FILE__) . "/..", false);
|
||||
define("CHANDLER_ROOT_CONF", yaml_parse_file(CHANDLER_ROOT . "/chandler.yml")["chandler"]);
|
||||
|
||||
/**
|
||||
* Bootstrap class, that is called during framework starting phase.
|
||||
|
@ -27,6 +26,16 @@ class Bootstrap
|
|||
Debugger::getBar()->addPanel(new Chandler\Debug\DatabasePanel);
|
||||
}
|
||||
|
||||
private function loadConfig(): void
|
||||
{
|
||||
if(!file_exists($conf = CHANDLER_ROOT . "/chandler.yml"))
|
||||
if(!file_exists($conf = CHANDLER_ROOT . "/../chandler.yml"))
|
||||
if(!file_exists($conf = "/etc/chandler.d/chandler.yml"))
|
||||
exit("Configuration file not found... Have you forgotten to rename it?");
|
||||
|
||||
define("CHANDLER_ROOT_CONF", chandler_parse_yaml($conf)["chandler"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads procedural APIs.
|
||||
*
|
||||
|
@ -128,6 +137,7 @@ class Bootstrap
|
|||
{
|
||||
$this->registerFunctions();
|
||||
$this->registerAutoloaders();
|
||||
$this->loadConfig();
|
||||
$this->registerDebugger();
|
||||
$this->igniteExtensions();
|
||||
|
||||
|
|
Loading…
Reference in a new issue