mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-04 05:15:41 -05:00
backend cleanup
This commit is contained in:
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Pterodactyl\Extensions;
|
||||
|
||||
use Illuminate\Config\Repository as ConfigRepository;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
|
||||
class DynamicDatabaseConnection
|
||||
@@ -17,14 +17,6 @@ class DynamicDatabaseConnection
|
||||
|
||||
public const string DB_DRIVER = 'mysql';
|
||||
|
||||
/**
|
||||
* DynamicDatabaseConnection constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
protected ConfigRepository $config,
|
||||
protected Encrypter $encrypter,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Adds a dynamic database connection entry to the runtime config.
|
||||
*
|
||||
@@ -36,13 +28,13 @@ class DynamicDatabaseConnection
|
||||
$host = DatabaseHost::query()->findOrFail($host);
|
||||
}
|
||||
|
||||
$this->config->set('database.connections.'.$connection, [
|
||||
Config::set('database.connections.'.$connection, [
|
||||
'driver' => self::DB_DRIVER,
|
||||
'host' => $host->host,
|
||||
'port' => $host->port,
|
||||
'database' => $database,
|
||||
'username' => $host->username,
|
||||
'password' => $this->encrypter->decrypt($host->password),
|
||||
'password' => Crypt::decrypt($host->password),
|
||||
'charset' => self::DB_CHARSET,
|
||||
'collation' => self::DB_COLLATION,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user