Commit
This commit is contained in:
parent
7882449469
commit
5659ee2a52
16
app/core/Config.php
Normal file
16
app/core/Config.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Config
|
||||||
|
{
|
||||||
|
public array $config;
|
||||||
|
|
||||||
|
public function __construct(string $path)
|
||||||
|
{
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
echo("Could not find $path");
|
||||||
|
throw new Exception("Could not find $path");
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->config = require $path;
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,9 @@ spl_autoload_register(function ($class_name) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
$config = require __DIR__ . '/config.php';
|
$config = (
|
||||||
|
new Config(__DIR__ . '/config.php')
|
||||||
|
)->config;
|
||||||
$database = new Database($config['database']);
|
$database = new Database($config['database']);
|
||||||
$session = new Session;
|
$session = new Session;
|
||||||
$user = new User($session);
|
$user = new User($session);
|
||||||
|
Reference in New Issue
Block a user