mirror of
https://github.com/coollabsio/coolify.git
synced 2026-08-29 10:06:44 -05:00
Integrates Valkey as a new standalone database type. This includes adding the necessary model, updating actions to handle Valkey instances, and documenting the integration process.
75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Database;
|
|
|
|
use Auth;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Livewire\Component;
|
|
|
|
class Configuration extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
public $currentRoute;
|
|
|
|
public $database;
|
|
|
|
public $project;
|
|
|
|
public $environment;
|
|
|
|
public function getListeners()
|
|
{
|
|
$teamId = Auth::user()->currentTeam()->id;
|
|
|
|
return [
|
|
"echo-private:team.{$teamId},ServiceChecked" => '$refresh',
|
|
];
|
|
}
|
|
|
|
public function mount()
|
|
{
|
|
try {
|
|
$this->currentRoute = request()->route()->getName();
|
|
|
|
$project = currentTeam()
|
|
->projects()
|
|
->select('id', 'uuid', 'team_id')
|
|
->where('uuid', request()->route('project_uuid'))
|
|
->firstOrFail();
|
|
$environment = $project->environments()
|
|
->select('id', 'name', 'project_id', 'uuid')
|
|
->with(['postgresqls', 'redis', 'valkeys', 'mongodbs', 'mysqls', 'mariadbs', 'keydbs', 'dragonflies', 'clickhouses'])
|
|
->where('uuid', request()->route('environment_uuid'))
|
|
->firstOrFail();
|
|
$database = $environment->databases()
|
|
->where('uuid', request()->route('database_uuid'))
|
|
->firstOrFail();
|
|
|
|
$this->authorize('view', $database);
|
|
|
|
$this->database = $database;
|
|
$this->project = $project;
|
|
$this->environment = $environment;
|
|
if (str($this->database->status)->startsWith('running') && is_null($this->database->config_hash)) {
|
|
$this->database->isConfigurationChanged(true);
|
|
$this->dispatch('configurationChanged');
|
|
}
|
|
} catch (\Throwable $e) {
|
|
if ($e instanceof \Illuminate\Auth\Access\AuthorizationException) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
if ($e instanceof \Illuminate\Support\ItemNotFoundException) {
|
|
return redirect()->route('dashboard');
|
|
}
|
|
|
|
return handleError($e, $this);
|
|
}
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.project.database.configuration');
|
|
}
|
|
}
|