Skip to content

Commit 56ae346

Browse files
committed
test
1 parent 37e4bfe commit 56ae346

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

database/seeders/ProductionSeeder.php

+29-28
Original file line numberDiff line numberDiff line change
@@ -63,40 +63,13 @@ public function run(): void
6363
]);
6464
}
6565

66-
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
67-
$coolify_key_name = '@host.docker.internal';
68-
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
69-
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
70-
71-
$private_key_found = PrivateKey::find(0);
72-
if (! $private_key_found) {
73-
if ($coolify_key) {
74-
$user = str($coolify_key)->before('@')->after('id.');
75-
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
76-
PrivateKey::create([
77-
'id' => 0,
78-
'team_id' => 0,
79-
'name' => 'localhost\'s key',
80-
'description' => 'The private key for the Coolify host machine (localhost).',
81-
'private_key' => $coolify_key,
82-
]);
83-
echo "SSH key found for the Coolify host machine (localhost).\n";
84-
} else {
85-
echo "No SSH key found for the Coolify host machine (localhost).\n";
86-
echo "Please read the following documentation (point 3) to fix it: https://coolify.
87-
io/docs/knowledge-base/server/openssh/\n";
88-
echo "Your localhost connection won't work until then.";
89-
}
90-
}
91-
}
92-
9366
if (! isCloud()) {
9467
if (Server::find(0) == null) {
9568
$server_details = [
9669
'id' => 0,
9770
'name' => 'localhost',
9871
'description' => "This is the server where Coolify is running on. Don't delete this!",
99-
'user' => $user,
72+
'user' => 'root',
10073
'ip' => 'host.docker.internal',
10174
'team_id' => 0,
10275
'private_key_id' => 0,
@@ -125,7 +98,35 @@ public function run(): void
12598
]);
12699
}
127100
}
101+
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
102+
$coolify_key_name = '@host.docker.internal';
103+
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
104+
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
128105

106+
$private_key_found = PrivateKey::find(0);
107+
if (! $private_key_found) {
108+
if ($coolify_key) {
109+
$user = str($coolify_key)->before('@')->after('id.');
110+
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
111+
PrivateKey::create([
112+
'id' => 0,
113+
'team_id' => 0,
114+
'name' => 'localhost\'s key',
115+
'description' => 'The private key for the Coolify host machine (localhost).',
116+
'private_key' => $coolify_key,
117+
]);
118+
$server = Server::find(0);
119+
$server->user = $user;
120+
$server->save();
121+
echo "SSH key found for the Coolify host machine (localhost).\n";
122+
} else {
123+
echo "No SSH key found for the Coolify host machine (localhost).\n";
124+
echo "Please read the following documentation (point 3) to fix it: https://coolify.
125+
io/docs/knowledge-base/server/openssh/\n";
126+
echo "Your localhost connection won't work until then.";
127+
}
128+
}
129+
}
129130
if (config('constants.coolify.is_windows_docker_desktop')) {
130131
PrivateKey::updateOrCreate(
131132
[

0 commit comments

Comments
 (0)