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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
use shared functions when possible
peaklabs-dev175f4b9ae1db
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.phpindex 05310e413f..1ad12cf362 100644--- a/app/Models/PrivateKey.php+++ b/app/Models/PrivateKey.php@@ -43,7 +43,7 @@ class PrivateKey extends BaseModelprotected static function booted(){static::saving(function ($key) {- $key->private_key = rtrim($key->private_key) . "\n";+ $key->private_key = formatPrivateKey($key->private_key);if (!self::validatePrivateKey($key->private_key)) {throw ValidationException::withMessages([@@ -101,13 +101,13 @@ class PrivateKey extends BaseModel$instance->rateLimit(10);$name = generate_random_name();$description = 'Created by Coolify';- ['private' => $privateKey, 'public' => $publicKey] = generateSSHKey($type === 'ed25519' ? 'ed25519' : 'rsa');+ $keyPair = generateSSHKey($type === 'ed25519' ? 'ed25519' : 'rsa');return ['name' => $name,'description' => $description,- 'private_key' => $privateKey,- 'public_key' => $publicKey,+ 'private_key' => $keyPair['private'],+ 'public_key' => $keyPair['public'],];} catch (\Throwable $e) {throw new \Exception("Failed to generate new {$type} key: " . $e->getMessage());