syokuhou/syokuhou.php
2024-11-14 01:22:18 +00:00

32 lines
890 B
PHP

<?php
namespace Syokuhou;
use Index\Config\Fs\FsConfig;
define('SKH_STARTUP', microtime(true));
define('SKH_ROOT', __DIR__);
define('SKH_CLI', PHP_SAPI === 'cli');
define('SKH_DEBUG', is_file(SKH_ROOT . '/.debug'));
require_once SKH_ROOT . '/vendor/autoload.php';
error_reporting(SKH_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
$cfg = FsConfig::fromFile(SKH_ROOT . '/syokuhou.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 SyokuhouContext($cfg);