From 56ae346b9d7802ca67a99d1aeb8d431749d19747 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 17 Jan 2025 13:22:04 +0100 Subject: [PATCH] test --- database/seeders/ProductionSeeder.php | 57 ++++++++++++++------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 268fd8291..3bcf7d193 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -63,40 +63,13 @@ class ProductionSeeder extends Seeder ]); } - if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) { - $coolify_key_name = '@host.docker.internal'; - $ssh_keys_directory = Storage::disk('ssh-keys')->files(); - $coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name)); - - $private_key_found = PrivateKey::find(0); - if (! $private_key_found) { - if ($coolify_key) { - $user = str($coolify_key)->before('@')->after('id.'); - $coolify_key = Storage::disk('ssh-keys')->get($coolify_key); - PrivateKey::create([ - 'id' => 0, - 'team_id' => 0, - 'name' => 'localhost\'s key', - 'description' => 'The private key for the Coolify host machine (localhost).', - 'private_key' => $coolify_key, - ]); - echo "SSH key found for the Coolify host machine (localhost).\n"; - } else { - 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 "Your localhost connection won't work until then."; - } - } - } - if (! isCloud()) { if (Server::find(0) == null) { $server_details = [ 'id' => 0, 'name' => 'localhost', 'description' => "This is the server where Coolify is running on. Don't delete this!", - 'user' => $user, + 'user' => 'root', 'ip' => 'host.docker.internal', 'team_id' => 0, 'private_key_id' => 0, @@ -125,7 +98,35 @@ class ProductionSeeder extends Seeder ]); } } + if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) { + $coolify_key_name = '@host.docker.internal'; + $ssh_keys_directory = Storage::disk('ssh-keys')->files(); + $coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name)); + $private_key_found = PrivateKey::find(0); + if (! $private_key_found) { + if ($coolify_key) { + $user = str($coolify_key)->before('@')->after('id.'); + $coolify_key = Storage::disk('ssh-keys')->get($coolify_key); + PrivateKey::create([ + 'id' => 0, + 'team_id' => 0, + 'name' => 'localhost\'s key', + 'description' => 'The private key for the Coolify host machine (localhost).', + 'private_key' => $coolify_key, + ]); + $server = Server::find(0); + $server->user = $user; + $server->save(); + echo "SSH key found for the Coolify host machine (localhost).\n"; + } else { + 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 "Your localhost connection won't work until then."; + } + } + } if (config('constants.coolify.is_windows_docker_desktop')) { PrivateKey::updateOrCreate( [