Updated config usage in Awaki.

This commit is contained in:
flash 2023-12-15 02:19:17 +00:00
parent 67688a8c51
commit de5e84073d
2 changed files with 4 additions and 8 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@
/config/config.ini
/public/robots.txt
/vendor
/awaki.cfg

View file

@ -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 '<h3>Unable to connect to database</h3>';
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'));