diff --git a/.gitignore b/.gitignore index 4bbb441..03dd658 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /config/config.ini /public/robots.txt /vendor +/awaki.cfg diff --git a/awaki.php b/awaki.php index 9c5c432..ffedcfe 100644 --- a/awaki.php +++ b/awaki.php @@ -11,14 +11,13 @@ define('AWK_ROOT', __DIR__); define('AWK_DEBUG', is_file(AWK_ROOT . '/.debug')); define('AWK_DIR_SRC', AWK_ROOT . '/src'); define('AWK_DIR_PUB', AWK_ROOT . '/public'); -define('AWK_DIR_CFG', AWK_ROOT . '/config'); define('AWK_DIR_DBM', AWK_ROOT . '/database'); require_once AWK_ROOT . '/vendor/autoload.php'; Environment::setDebug(AWK_DEBUG); -$config = SharpConfig::fromFile(AWK_DIR_CFG . '/config.cfg'); +$config = SharpConfig::fromFile(AWK_ROOT . '/awaki.cfg'); if($config->hasValues('sentry:dsn')) (function($cfg) { @@ -33,11 +32,7 @@ if($config->hasValues('sentry:dsn')) }); })($config->scopeTo('sentry')); -try { - $db = DbTools::create($config->getString('dsn')); -} catch(ConnectionFailedException $ex) { - echo '

Unable to connect to database

'; - die($ex->getMessage()); -} +$db = DbTools::create($cfg->getString('database:dsn', 'null:')); +$db->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\';'); $awk = new AwakiContext($db, $config->scopeTo('urls'));