syokuhou/syokuhou.php

33 lines
890 B
PHP
Raw Permalink Normal View History

2024-08-25 01:50:52 +00:00
<?php
2024-11-14 01:22:18 +00:00
namespace Syokuhou;
2024-08-25 01:50:52 +00:00
2024-11-14 00:38:12 +00:00
use Index\Config\Fs\FsConfig;
2024-08-25 01:50:52 +00:00
2024-11-14 01:22:18 +00:00
define('SKH_STARTUP', microtime(true));
define('SKH_ROOT', __DIR__);
define('SKH_CLI', PHP_SAPI === 'cli');
define('SKH_DEBUG', is_file(SKH_ROOT . '/.debug'));
2024-08-25 01:50:52 +00:00
2024-11-14 01:22:18 +00:00
require_once SKH_ROOT . '/vendor/autoload.php';
2024-08-25 01:50:52 +00:00
2024-11-14 01:22:18 +00:00
error_reporting(SKH_DEBUG ? -1 : 0);
2024-08-25 01:50:52 +00:00
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
2024-11-14 01:22:18 +00:00
$cfg = FsConfig::fromFile(SKH_ROOT . '/syokuhou.cfg');
2024-08-25 01:50:52 +00:00
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'));
2024-11-14 01:22:18 +00:00
$ctx = new SyokuhouContext($cfg);