Make sure key is not created with wrong private_key
This commit is contained in:
@@ -106,7 +106,8 @@ class ProductionSeeder extends Seeder
|
|||||||
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
|
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
|
||||||
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
|
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
|
||||||
|
|
||||||
$found = PrivateKey::find(0);
|
$server = Server::find(0);
|
||||||
|
$found = $server->privateKey;
|
||||||
if ($found) {
|
if ($found) {
|
||||||
echo 'Private Key found in database.\n';
|
echo 'Private Key found in database.\n';
|
||||||
if ($coolify_key) {
|
if ($coolify_key) {
|
||||||
@@ -125,17 +126,7 @@ class ProductionSeeder extends Seeder
|
|||||||
]);
|
]);
|
||||||
$server->update(['user' => $user]);
|
$server->update(['user' => $user]);
|
||||||
echo "SSH key found for the Coolify host machine (localhost).\n";
|
echo "SSH key found for the Coolify host machine (localhost).\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrivateKey::create(
|
|
||||||
[
|
|
||||||
'id' => 0,
|
|
||||||
'team_id' => 0,
|
|
||||||
'name' => 'localhost\'s key',
|
|
||||||
'description' => 'The private key for the Coolify host machine (localhost).',
|
|
||||||
'private_key' => 'Paste here you private key!!',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
echo "No SSH key found for the Coolify host machine (localhost).\n";
|
echo "No SSH key found for the Coolify host machine (localhost).\n";
|
||||||
echo "Please read the following documentation (point 3) to fix it: https://coolify.io/docs/knowledge-base/server/openssh/\n";
|
echo "Please read the following documentation (point 3) to fix it: https://coolify.io/docs/knowledge-base/server/openssh/\n";
|
||||||
echo "Your localhost connection won't work until then.";
|
echo "Your localhost connection won't work until then.";
|
||||||
|
|||||||
Reference in New Issue
Block a user