37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
namespace Satori;
|
|
|
|
use Index\Data\DbTools;
|
|
use Syokuhou\SharpConfig;
|
|
|
|
define('SAT_ROOT', __DIR__);
|
|
define('SAT_DIR_MIGRATIONS', SAT_ROOT . '/database');
|
|
define('SAT_DIR_PUBLIC', SAT_ROOT . '/public');
|
|
define('SAT_DEBUG', is_file(SAT_ROOT . '/.debug'));
|
|
define('SAT_VERSION', '20240805');
|
|
|
|
require_once SAT_ROOT . '/vendor/autoload.php';
|
|
|
|
error_reporting(SAT_DEBUG ? -1 : 0);
|
|
mb_internal_encoding('utf-8');
|
|
date_default_timezone_set('utc');
|
|
|
|
$cfg = SharpConfig::fromFile(SAT_ROOT . '/config.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'));
|
|
|
|
$dbc = DbTools::create($cfg->getString('database:dsn', 'null'));
|
|
$dbc->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';');
|
|
|
|
$sat = new SatoriContext($cfg, $dbc);
|