Feat: Store all keys on disk by default
This commit is contained in:
@@ -10,7 +10,6 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Empty the SSH keys folder
|
|
||||||
Storage::disk('ssh-keys')->deleteDirectory('');
|
Storage::disk('ssh-keys')->deleteDirectory('');
|
||||||
Storage::disk('ssh-keys')->makeDirectory('');
|
Storage::disk('ssh-keys')->makeDirectory('');
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ return new class extends Migration
|
|||||||
$table->boolean('is_sftp_key')->default(false);
|
$table->boolean('is_sftp_key')->default(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Re-save SSH keys on server only for records with is_server_ssh_key = true
|
|
||||||
PrivateKey::where('is_server_ssh_key', true)->chunk(100, function ($keys) {
|
PrivateKey::where('is_server_ssh_key', true)->chunk(100, function ($keys) {
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$key->storeInFileSystem();
|
$key->storeInFileSystem();
|
||||||
@@ -30,8 +28,8 @@ return new class extends Migration
|
|||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('private_keys', function (Blueprint $table) {
|
Schema::table('private_keys', function (Blueprint $table) {
|
||||||
$table->dropColumn('is_sftp_storage_key');
|
|
||||||
$table->dropColumn('is_server_ssh_key');
|
$table->dropColumn('is_server_ssh_key');
|
||||||
|
$table->dropColumn('is_sftp_key');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -15,7 +15,7 @@ class PrivateKeySeeder extends Seeder
|
|||||||
PrivateKey::create([
|
PrivateKey::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
'name' => 'Testing-host',
|
'name' => 'Testing Host Key',
|
||||||
'description' => 'This is a test docker container',
|
'description' => 'This is a test docker container',
|
||||||
'private_key' => '-----BEGIN OPENSSH PRIVATE KEY-----
|
'private_key' => '-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
|
||||||
@@ -25,8 +25,9 @@ AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV
|
|||||||
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
||||||
-----END OPENSSH PRIVATE KEY-----
|
-----END OPENSSH PRIVATE KEY-----
|
||||||
',
|
',
|
||||||
|
'is_server_ssh_key' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
PrivateKey::create([
|
PrivateKey::create([
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
@@ -61,12 +62,5 @@ a1C8EDKapCw5hAhizEFOUQKOygL8Ipn+tmEUkORYdZ8Q8cWFCv9nIw==
|
|||||||
-----END RSA PRIVATE KEY-----',
|
-----END RSA PRIVATE KEY-----',
|
||||||
'is_git_related' => true,
|
'is_git_related' => true,
|
||||||
]);
|
]);
|
||||||
PrivateKey::create([
|
|
||||||
'id' => 2,
|
|
||||||
'team_id' => 0,
|
|
||||||
'name' => 'development-gitlab-app',
|
|
||||||
'description' => 'This is the key for using the development Gitlab app',
|
|
||||||
'private_key' => 'asdf',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user