Skip to content

Commit

Permalink
Must use bootstrap.php, otherwise appDir is detected in www
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsvec committed Jul 16, 2014
1 parent e4307e4 commit 3758ce6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
35 changes: 35 additions & 0 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Nette\Diagnostics\Debugger;

define('APP_DIR', __DIR__ . '/../app');

require __DIR__ . '/../vendor/autoload.php';
\Nette\Diagnostics\Debugger::enable(Debugger::DEVELOPMENT);

// Configure application
$configurator = new \Nette\Configurator();
$configurator->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;
37 changes: 1 addition & 36 deletions www/index.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
<?php

use Nette\Diagnostics\Debugger;
$container = require __DIR__ . '/../app/bootstrap.php';

define('ROOT_DIR', realpath(__DIR__ . '/../'));
define('WWW_DIR', __DIR__);
define('APP_DIR', ROOT_DIR . '/app');
define('LIBS_DIR', ROOT_DIR . '/libs');

// Load libraries
require ROOT_DIR . '/vendor/autoload.php';
//\Nette\Framework::$iAmUsingBadHost = TRUE;
//\Nette\Diagnostics\Debugger::enable(false);
\Nette\Diagnostics\Debugger::enable(Debugger::DEVELOPMENT);

// Configure application
$configurator = new \Nette\Configurator();
$configurator->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();

0 comments on commit 3758ce6

Please sign in to comment.