Skip to content

Commit 795af8d

Browse files
committed
Make sure key is not created with wrong private_key
1 parent 56ec0a3 commit 795af8d

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

database/seeders/ProductionSeeder.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public function run(): void
106106
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
107107
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
108108

109-
$found = PrivateKey::find(0);
109+
$server = Server::find(0);
110+
$found = $server->privateKey;
110111
if ($found) {
111112
echo 'Private Key found in database.\n';
112113
if ($coolify_key) {
@@ -125,17 +126,7 @@ public function run(): void
125126
]);
126127
$server->update(['user' => $user]);
127128
echo "SSH key found for the Coolify host machine (localhost).\n";
128-
129129
} else {
130-
PrivateKey::create(
131-
[
132-
'id' => 0,
133-
'team_id' => 0,
134-
'name' => 'localhost\'s key',
135-
'description' => 'The private key for the Coolify host machine (localhost).',
136-
'private_key' => 'Paste here you private key!!',
137-
]
138-
);
139130
echo "No SSH key found for the Coolify host machine (localhost).\n";
140131
echo "Please read the following documentation (point 3) to fix it: https://coolify.io/docs/knowledge-base/server/openssh/\n";
141132
echo "Your localhost connection won't work until then.";

0 commit comments

Comments
 (0)