Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Remove unnecessary code in PrivateKey model

Andras Bacsaic0898f0568ee
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php
index 58e12d6cb6..46ca06f5c3 100644
--- a/app/Models/PrivateKey.php
+++ b/app/Models/PrivateKey.php
@@ -52,7 +52,6 @@ class PrivateKey extends BaseModel
}
$key->fingerprint = self::generateFingerprint($key->private_key);
-
if (self::fingerprintExists($key->fingerprint, $key->id)) {
throw ValidationException::withMessages([
'private_key' => ['This private key already exists.'],
@@ -142,10 +141,7 @@ class PrivateKey extends BaseModel
public function storeInFileSystem()
{
$filename = "ssh_key@{$this->uuid}";
- echo 'Storing key: '.$filename."\n".'Private key: '.$this->private_key."\n";
Storage::disk('ssh-keys')->put($filename, $this->private_key);
- $file = Storage::disk('ssh-keys')->get($filename);
- echo 'File: '.$file."\n";
return "/var/www/html/storage/app/ssh/keys/{$filename}";
}
@@ -224,7 +220,7 @@ class PrivateKey extends BaseModel
{
$query = self::where('fingerprint', $fingerprint);
- if ($excludeId) {
+ if (! is_null($excludeId)) {
$query->where('id', '!=', $excludeId);
}