Updated config usage in Hanyuu.
This commit is contained in:
parent
d4a68172f8
commit
67d86e4d0b
3 changed files with 14 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@
|
|||
/config/config.cfg
|
||||
/config/config.ini
|
||||
/vendor
|
||||
/hanyuu.cfg
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
database:dsn mariadb://username:password@:unix:/database?socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4
|
||||
|
||||
site:name Hanyuu
|
16
hanyuu.php
16
hanyuu.php
|
@ -12,7 +12,6 @@ define('HAU_CLI', PHP_SAPI === 'cli');
|
|||
define('HAU_DEBUG', is_file(HAU_ROOT . '/.debug'));
|
||||
define('HAU_DIR_PUBLIC', HAU_ROOT . '/public');
|
||||
define('HAU_DIR_SOURCE', HAU_ROOT . '/src');
|
||||
define('HAU_DIR_CONFIG', HAU_ROOT . '/config');
|
||||
define('HAU_DIR_MIGRATIONS', HAU_ROOT . '/database');
|
||||
define('HAU_DIR_TEMPLATES', HAU_ROOT . '/templates');
|
||||
|
||||
|
@ -24,7 +23,20 @@ mb_internal_encoding('utf-8');
|
|||
date_default_timezone_set('utc');
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . HAU_ROOT);
|
||||
|
||||
$cfg = SharpConfig::fromFile(HAU_ROOT . '/hanyuu.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),
|
||||
]);
|
||||
})($cfg->scopeTo('sentry'));
|
||||
|
||||
set_exception_handler(function(\Throwable $ex) {
|
||||
\Sentry\captureException($ex);
|
||||
|
||||
if(HAU_CLI)
|
||||
die((string)$ex);
|
||||
|
||||
|
@ -40,8 +52,6 @@ set_exception_handler(function(\Throwable $ex) {
|
|||
die('<h2>Hanyuu is sad.</h2>');
|
||||
});
|
||||
|
||||
$cfg = SharpConfig::fromFile(HAU_DIR_CONFIG . '/config.cfg');
|
||||
|
||||
$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\';');
|
||||
|
||||
|
|
Loading…
Reference in a new issue