fix: store original root key in the original location

This commit is contained in:
Andras Bacsai
2024-09-19 16:35:10 +02:00
parent 7d54fe9c18
commit 1815c9dccf

View File

@@ -1,8 +1,8 @@
<?php
use App\Models\PrivateKey;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Storage;
use App\Models\PrivateKey;
class PopulateSshKeysAndClearMuxDirectory extends Migration
{
@@ -13,10 +13,12 @@ class PopulateSshKeysAndClearMuxDirectory extends Migration
Storage::disk('ssh-mux')->deleteDirectory('');
Storage::disk('ssh-mux')->makeDirectory('');
PrivateKey::chunk(100, function ($keys) {
foreach ($keys as $key) {
$key->storeInFileSystem();
if ($key->id === 0) {
Storage::disk('ssh-keys')->put('id.root@host.docker.internal', $key->private_key);
}
}
});
}