diff --git a/app/bootstrap.php b/app/bootstrap.php new file mode 100644 index 0000000..ee08a0b --- /dev/null +++ b/app/bootstrap.php @@ -0,0 +1,35 @@ +setDebugMode(true); +$configurator->setTempDirectory(__DIR__ . '/../temp'); +$configurator->enableDebugger(__DIR__ . '/../log'); +$configurator->createRobotLoader() +->addDirectory(__DIR__ . '/../app') +->addDirectory(__DIR__ . '/../components') +->register(); + +// basic environment resolution +$environment = null; + +// jenkins server runs on nginx +if (false !== strstr($_SERVER["SERVER_SOFTWARE"], "nginx")) { +$environment = "jenkins"; +$configurator->setDebugMode(false); +\Nette\Diagnostics\Debugger::enable(Debugger::PRODUCTION); +} + +$configurator->addConfig(__DIR__ . '/../app/config/config.neon', $environment); + +$container = $configurator->createContainer(); +$container->application->catchExceptions = false; + +return $container; diff --git a/www/index.php b/www/index.php index c507b3e..0d8c87c 100644 --- a/www/index.php +++ b/www/index.php @@ -1,40 +1,5 @@ setDebugMode(true); -$configurator->setTempDirectory(ROOT_DIR . '/temp'); -$configurator->enableDebugger(__DIR__ . '/../log'); -$configurator->createRobotLoader() - ->addDirectory(APP_DIR) - ->addDirectory(ROOT_DIR . '/components') -// ->addDirectory(LIBS_DIR) - ->register(); - -// basic environment resolution -$environment = null; - -// jenkins server runs on nginx -if (false !== strstr($_SERVER["SERVER_SOFTWARE"], "nginx")) { - $environment = "jenkins"; - $configurator->setDebugMode(false); - \Nette\Diagnostics\Debugger::enable(Debugger::PRODUCTION); -} - -$configurator->addConfig(ROOT_DIR . '/app/config/config.neon', $environment); -$container = $configurator->createContainer(); -$container->application->catchExceptions = false; $container->getService('application')->run();