<?php
namespace Misuzu;

use Index\Config\Fs\FsConfig;

define('MSZ_STARTUP', microtime(true));
define('MSZ_ROOT', __DIR__);

require_once __DIR__ . '/vendor/autoload.php';

$env = FsConfig::fromFile(Misuzu::PATH_CONFIG . '/config.cfg');

if($env->hasValues('sentry:dsn'))
    (function($env) {
        \Sentry\init([
            'dsn' => $env->getString('dsn'),
            'traces_sample_rate' => $env->getFloat('tracesRate', 0.2),
            'profiles_sample_rate' => $env->getFloat('profilesRate', 0.2),
        ]);

        set_exception_handler(function(\Throwable $ex) {
            \Sentry\captureException($ex);
        });
    })($env->scopeTo('sentry'));

$msz = new MisuzuContext($env);