You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
<?php
|
|
|
|
namespace NetteUtils\System;
|
|
|
|
use Nette\Bootstrap\Configurator;
|
|
|
|
class Bootstrap
|
|
{
|
|
public static function boot(): Configurator
|
|
{
|
|
$configurator = new Configurator;
|
|
|
|
if (getenv('APP_ENV') == 'local' || getenv('PHP_ENV') == 'development') {
|
|
$configurator->setDebugMode(true);
|
|
} else {
|
|
$configurator->setDebugMode(false);
|
|
}
|
|
$configurator->enableTracy(__DIR__ . '/../log');
|
|
|
|
self::setupCommon($configurator);
|
|
|
|
$configurator->addConfig(__DIR__ . '/Config/local.neon');
|
|
|
|
return $configurator;
|
|
}
|
|
|
|
|
|
|
|
public static function bootForTests(): Configurator
|
|
{
|
|
$configurator = new Configurator;
|
|
|
|
self::setupCommon($configurator);
|
|
|
|
$configurator->addConfig(__DIR__ . '/Config/test.neon');
|
|
|
|
return $configurator;
|
|
}
|
|
|
|
|
|
|
|
protected static function setupCommon(Configurator $configurator) : void
|
|
{
|
|
$configurator->setTimeZone('Europe/Prague');
|
|
$configurator->setTempDirectory(__DIR__ . '/../temp');
|
|
|
|
$configurator->createRobotLoader()
|
|
->addDirectory(__DIR__)
|
|
->addDirectory(__DIR__ . '/../src')
|
|
->register();
|
|
|
|
$configurator->addConfig(__DIR__ . '/Config/config.neon');
|
|
}
|
|
}
|