fix: store original root key in the original location
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Models\PrivateKey;
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Models\PrivateKey;
|
|
||||||
|
|
||||||
class PopulateSshKeysAndClearMuxDirectory extends Migration
|
class PopulateSshKeysAndClearMuxDirectory extends Migration
|
||||||
{
|
{
|
||||||
@@ -13,10 +13,12 @@ class PopulateSshKeysAndClearMuxDirectory extends Migration
|
|||||||
|
|
||||||
Storage::disk('ssh-mux')->deleteDirectory('');
|
Storage::disk('ssh-mux')->deleteDirectory('');
|
||||||
Storage::disk('ssh-mux')->makeDirectory('');
|
Storage::disk('ssh-mux')->makeDirectory('');
|
||||||
|
|
||||||
PrivateKey::chunk(100, function ($keys) {
|
PrivateKey::chunk(100, function ($keys) {
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$key->storeInFileSystem();
|
$key->storeInFileSystem();
|
||||||
|
if ($key->id === 0) {
|
||||||
|
Storage::disk('ssh-keys')->put('id.root@host.docker.internal', $key->private_key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user