Fix: Populate SSH keys in dev
This commit is contained in:
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\PrivateKey;
|
||||
|
||||
return new class extends Migration
|
||||
class PopulateSshKeysDirectory extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
@@ -17,10 +17,4 @@ return new class extends Migration
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Storage::disk('ssh-keys')->deleteDirectory('');
|
||||
Storage::disk('ssh-keys')->makeDirectory('');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ class DatabaseSeeder extends Seeder
|
||||
UserSeeder::class,
|
||||
TeamSeeder::class,
|
||||
PrivateKeySeeder::class,
|
||||
PopulateSshKeysDirectorySeeder::class,
|
||||
ServerSeeder::class,
|
||||
ServerSettingSeeder::class,
|
||||
ProjectSeeder::class,
|
||||
|
22
database/seeders/PopulateSshKeysDirectorySeeder.php
Normal file
22
database/seeders/PopulateSshKeysDirectorySeeder.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Models\PrivateKey;
|
||||
|
||||
class PopulateSshKeysDirectorySeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Storage::disk('ssh-keys')->deleteDirectory('');
|
||||
Storage::disk('ssh-keys')->makeDirectory('');
|
||||
|
||||
PrivateKey::chunk(100, function ($keys) {
|
||||
foreach ($keys as $key) {
|
||||
$key->storeInFileSystem();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user