introduced configcontroller

This commit is contained in:
tracer 2022-09-17 16:26:14 +02:00
parent 4bff4182c8
commit d1325202ee
1 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,5 @@
<?php
namespace App\Controller;
error_reporting(error_level: E_ALL);
@ -21,9 +22,14 @@ class DatabaseConnection
const TABLE_APIKEYS = self::TABLE_PREFIX . "apikeys";
const TABLE_DYNDNS = self::TABLE_PREFIX . "dyndns";
public function __construct(private array $config)
public function __construct(private readonly ConfigController $configController)
{
extract(array: $this->config);
$dbHost = $this->configController->getConfig(configKey: 'dbHost');
$dbPort = $this->configController->getConfig(configKey: 'dbPort');
$dbDatabase = $this->configController->getConfig(configKey: 'dbDatabase');
$dbUser = $this->configController->getConfig(configKey: 'dbUser');
$dbPassword = $this->configController->getConfig(configKey: 'dbPassword');
// TODO create config => encryption key
try {
$this->dbConnection = new PDO(