32 lines
887 B
PHP
32 lines
887 B
PHP
<?php
|
|
namespace Aleister;
|
|
|
|
use Syokuhou\FileConfig;
|
|
|
|
define('CRW_STARTUP', microtime(true));
|
|
define('CRW_ROOT', __DIR__);
|
|
define('CRW_CLI', PHP_SAPI === 'cli');
|
|
define('CRW_DEBUG', is_file(CRW_ROOT . '/.debug'));
|
|
|
|
require_once CRW_ROOT . '/vendor/autoload.php';
|
|
|
|
error_reporting(CRW_DEBUG ? -1 : 0);
|
|
mb_internal_encoding('UTF-8');
|
|
date_default_timezone_set('GMT');
|
|
|
|
$cfg = FileConfig::fromFile(CRW_ROOT . '/aleister.cfg');
|
|
|
|
if($cfg->hasValues('sentry:dsn'))
|
|
(function($cfg) {
|
|
\Sentry\init([
|
|
'dsn' => $cfg->getString('dsn'),
|
|
'traces_sample_rate' => $cfg->getFloat('tracesRate', 0.2),
|
|
'profiles_sample_rate' => $cfg->getFloat('profilesRate', 0.2),
|
|
]);
|
|
|
|
set_exception_handler(function(\Throwable $ex) {
|
|
\Sentry\captureException($ex);
|
|
});
|
|
})($cfg->scopeTo('sentry'));
|
|
|
|
$ctx = new AleisterContext($cfg);
|