41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
define('MSZ_STARTUP', hrtime(true));
|
|
define('MSZ_ROOT', __DIR__);
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
$msz = (function() {
|
|
$timings = new \Index\Performance\Timings(
|
|
new \Index\Performance\Stopwatch(MSZ_STARTUP),
|
|
);
|
|
|
|
try {
|
|
\Dotenv\Dotenv::createImmutable(Misuzu::PATH_ROOT)->load();
|
|
|
|
if(!empty($_ENV['SENTRY_DSN']))
|
|
\Sentry\init(['dsn' => $_ENV['SENTRY_DSN']]);
|
|
|
|
$whoops = new \Whoops\Run;
|
|
if(Misuzu::cli())
|
|
$whoops->pushHandler(new Whoops\SentryPlainTextHandler);
|
|
elseif(Misuzu::debug())
|
|
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
|
else
|
|
$whoops->pushHandler(new Whoops\SentryPageHandler);
|
|
|
|
$whoops->register();
|
|
|
|
return new MisuzuContext(
|
|
$timings,
|
|
$_ENV['DATABASE_DSN'] ?? 'null:',
|
|
$_ENV['DOMAIN_ROLES'] ?? 'localhost=main,redirect,storage',
|
|
$_ENV['STORAGE_PATH_LOCAL'] ?? Misuzu::PATH_STORAGE,
|
|
$_ENV['STORAGE_PATH_REMOTE'] ?? '/_storage',
|
|
$_ENV['TEMPLATE_CACHE'] ?? '',
|
|
);
|
|
} finally {
|
|
$timings->lap('startup');
|
|
}
|
|
})();
|