coolify/app/Http/Livewire/Server/PrivateKey.php

29 lines
735 B
PHP
Raw Normal View History

2023-05-03 12:38:57 +02:00
<?php
namespace App\Http\Livewire\Server;
use App\Models\Server;
2023-05-16 11:39:18 +02:00
use Illuminate\Support\Facades\Storage;
2023-05-03 12:38:57 +02:00
use Livewire\Component;
class PrivateKey extends Component
{
2023-06-15 14:18:49 +02:00
public Server $server;
public $privateKeys;
2023-05-03 12:38:57 +02:00
public $parameters;
public function setPrivateKey($private_key_id)
{
2023-06-15 14:18:49 +02:00
$this->server->update([
2023-05-03 12:38:57 +02:00
'private_key_id' => $private_key_id
]);
2023-06-15 14:18:49 +02:00
2023-05-16 11:39:18 +02:00
// Delete the old ssh mux file to force a new one to be created
2023-06-15 14:18:49 +02:00
Storage::disk('ssh-mux')->delete("{$this->server->first()->ip}_{$this->server->first()->port}_{$this->server->first()->user}");
$this->server->refresh();
2023-05-03 12:38:57 +02:00
}
public function mount()
{
2023-06-15 09:15:41 +02:00
$this->parameters = getRouteParameters();
2023-05-03 12:38:57 +02:00
}
}