fix: store original root key in the original location
This commit is contained in:
parent
7d54fe9c18
commit
1815c9dccf
1 changed files with 4 additions and 2 deletions
|
|
@ -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 @@ public function up()
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue