This commit is contained in:
Andras Bacsai
2023-05-16 11:39:18 +02:00
parent 752c86d8f7
commit a275ac5f41
11 changed files with 69 additions and 59 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Livewire\Server;
use App\Models\PrivateKey as ModelsPrivateKey;
use App\Models\Server;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use Livewire\Component;
class PrivateKey extends Component
@@ -13,9 +14,13 @@ class PrivateKey extends Component
public $parameters;
public function setPrivateKey($private_key_id)
{
Server::where('uuid', $this->parameters['server_uuid'])->update([
$server = Server::where('uuid', $this->parameters['server_uuid']);
$server->update([
'private_key_id' => $private_key_id
]);
// Delete the old ssh mux file to force a new one to be created
Storage::disk('local')->delete(".ssh/ssh_mux_{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}");
return redirect()->route('server.show', $this->parameters['server_uuid']);
}
public function mount()