diff --git a/chandler-example.yml b/chandler-example.yml index d29705d..e74dbc1 100644 --- a/chandler-example.yml +++ b/chandler-example.yml @@ -1,24 +1,23 @@ -chandler: - debug: true - websiteUrl: null - rootApp: "root" - - preferences: - appendExtension: "xhtml" - adminUrl: "/chandlerd" - exposeChandler: true - - extensions: - path: null - allEnabled: false - - database: - dsn: "mysql:host=localhost;dbname=db" - user: "root" - password: "root" - - security: - secret: "" - csrfProtection: "permissive" - extendedValidation: false - sessionDuration: 14 +debug: true +websiteUrl: null +rootApp: "root" + +preferences: + appendExtension: "xhtml" + adminUrl: "/chandlerd" + exposeChandler: true + +extensions: + path: null + allEnabled: false + +database: + dsn: "mysql:host=localhost;dbname=db" + user: "root" + password: "root" + +security: + secret: "" + csrfProtection: "permissive" + extendedValidation: false + sessionDuration: 14 diff --git a/chandler/Bootstrap.php b/chandler/Bootstrap.php index 1926de2..431b1d4 100644 --- a/chandler/Bootstrap.php +++ b/chandler/Bootstrap.php @@ -4,9 +4,6 @@ declare(strict_types = 1); use Tracy\Debugger; -define("CHANDLER_VER", "0.0.1", false); // IMPROVE: Remove this. -define("CHANDLER_ROOT", dirname(__FILE__) . "/..", false); // IMPROVE: Remove this. - /** * Bootstrap class, that is called during framework starting phase. * Initializes everything. @@ -27,29 +24,6 @@ class Bootstrap Chandler\Extensions\ExtensionManager::getInstance(); } - 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"]); - } - - /** - * Set ups autoloaders. - * - * @return void - * @internal - */ - private function registerAutoloaders(): void - { - spl_autoload_register(function ($class): void { - if (strpos($class, "Chandler\\") !== 0) return; - require_once(str_replace("\\", "/", str_replace("Chandler\\", CHANDLER_ROOT . "/chandler/", $class)) . ".php"); - }, true, true); - } - /** * Starts Tracy debugger session and installs panels. * diff --git a/public/index.php b/public/index.php index 7d44b56..aa750ff 100644 --- a/public/index.php +++ b/public/index.php @@ -4,6 +4,9 @@ declare(strict_types = 1); require_once(dirname(__DIR__) . "/vendor/autoload.php"); +define("CHANDLER_ROOT", dirname(__DIR__)); +define("CHANDLER_ROOT_CONF", yaml_parse_file(CHANDLER_ROOT . "/chandler.yml")); + $bootstrap = require("../chandler/Bootstrap.php"); $bootstrap->ignite();