/** * Load config */ public function loadConfig() { Config::load(CONFIG_DIR . DS . 'config.default.php'); Config::load(CONFIG_DIR . DS . sprintf('config.%s.php', getenv('RAD_ENVIRONMENT'))); Config::set('environment', getenv('RAD_ENVIRONMENT')); Config::set('debug', boolval(getenv('RAD_DEBUG'))); }
/** * Test set config */ public function testSet() { Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php'); Config::set('foo', 'new-bar'); $this->assertEquals(Config::get('foo'), 'new-bar'); Config::set('key1.sub-key1', 'new-val1'); $this->assertEquals(Config::get('key1.sub-key1'), 'new-val1'); Config::set('key1.sub-new-key1', 'val1'); $this->assertEquals(Config::get('key1.sub-new-key1'), 'val1'); }
/** * Init application * * @throws BaseException * @throws DependencyInjection\Exception */ protected function init() { $error = new ErrorHandler(); $error->setHandler(new JsonHandler())->setDebug(true)->register(); DotEnv::load(ROOT_DIR); if (!getenv('RAD_ENVIRONMENT')) { putenv('RAD_ENVIRONMENT=production'); } $this->container = Container::getInstance(); Config::set('environment', getenv('RAD_ENVIRONMENT')); Config::set('debug', (bool) getenv('RAD_DEBUG')); Bundles::loadAll($this->registerBundles()); $this->container->setShared('event_manager', new EventManager(), true); $this->loadConfig(); $this->loadService(); $this->loadServicesFromConfig(); $this->container->setShared('router', new Router()); $this->bundleStartup(); }