-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace App; | ||
|
||
use Nette; | ||
use Nette\Bootstrap\Configurator; | ||
|
||
|
||
|
@@ -12,28 +13,48 @@ | |
*/ | ||
class Bootstrap | ||
{ | ||
public static function boot(): Configurator | ||
private Configurator $configurator; | ||
private string $rootDir; | ||
|
||
|
||
public function __construct() | ||
{ | ||
$this->rootDir = dirname(__DIR__); | ||
|
||
// The configurator is responsible for setting up the application environment and services. | ||
// Learn more at https://doc.nette.org/en/bootstrap | ||
$configurator = new Configurator; | ||
$appDir = dirname(__DIR__); | ||
$this->configurator = new Configurator; | ||
|
||
// Set the directory for temporary files generated by Nette (e.g. compiled templates) | ||
$this->configurator->setTempDirectory($this->rootDir . '/temp'); | ||
} | ||
|
||
|
||
public function bootWebApplication(): Nette\DI\Container | ||
{ | ||
$this->initializeEnvironment(); | ||
$this->setupContainer(); | ||
return $this->configurator->createContainer(); | ||
} | ||
|
||
|
||
public function initializeEnvironment(): void | ||
{ | ||
// Nette is smart, and the development mode turns on automatically, | ||
// or you can enable for a specific IP address it by uncommenting the following line: | ||
// $configurator->setDebugMode('[email protected]'); | ||
// $this->configurator->setDebugMode('[email protected]'); | ||
|
||
// Enables Tracy: the ultimate "swiss army knife" debugging tool. | ||
// Learn more about Tracy at https://tracy.nette.org | ||
$configurator->enableTracy($appDir . '/log'); | ||
|
||
// Set the directory for temporary files generated by Nette (e.g. compiled templates) | ||
$configurator->setTempDirectory($appDir . '/temp'); | ||
$this->configurator->enableTracy($this->rootDir . '/log'); | ||
} | ||
|
||
// Add configuration files | ||
$configurator->addConfig($appDir . '/config/common.neon'); | ||
$configurator->addConfig($appDir . '/config/services.neon'); | ||
|
||
return $configurator; | ||
private function setupContainer(): void | ||
{ | ||
// Load configuration files | ||
$configDir = $this->rootDir . '/config'; | ||
$this->configurator->addConfig($configDir . '/common.neon'); | ||
$this->configurator->addConfig($configDir . '/services.neon'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters