Use .env file instead of local config.
This commit is contained in:
parent
4110cd5190
commit
e1cb500f99
16 changed files with 517 additions and 98 deletions
32
misuzu.php
32
misuzu.php
|
@ -1,26 +1,28 @@
|
|||
<?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');
|
||||
\Dotenv\Dotenv::createImmutable(Misuzu::PATH_ROOT)->load();
|
||||
|
||||
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),
|
||||
]);
|
||||
if(!empty($_ENV['SENTRY_DSN']))
|
||||
\Sentry\init(['dsn' => $_ENV['SENTRY_DSN']]);
|
||||
|
||||
set_exception_handler(function(\Throwable $ex) {
|
||||
\Sentry\captureException($ex);
|
||||
});
|
||||
})($env->scopeTo('sentry'));
|
||||
(function(\Whoops\RunInterface $whoops) {
|
||||
if(Misuzu::cli())
|
||||
$whoops->pushHandler(new Whoops\SentryPlainTextHandler);
|
||||
elseif(Misuzu::debug())
|
||||
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
|
||||
else
|
||||
$whoops->pushHandler(new Whoops\SentryPageHandler);
|
||||
|
||||
$msz = new MisuzuContext($env);
|
||||
$whoops->register();
|
||||
})(new \Whoops\Run);
|
||||
|
||||
$msz = new MisuzuContext(
|
||||
$_ENV['DATABASE_DSN'] ?? 'null:',
|
||||
$_ENV['DOMAIN_ROLES'] ?? 'localhost=main,redirect:/go'
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue