ran pint
This commit is contained in:
@@ -8,27 +8,30 @@ use Illuminate\Support\Facades\Process;
|
||||
class GenerateSshKey extends Command
|
||||
{
|
||||
protected $signature = 'setup:generate-ssh-key';
|
||||
|
||||
protected $description = 'Generates an SSH key pair for the application.';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if (file_exists(storage_path('app/private/ssh/id_ed25519'))) {
|
||||
$this->components->info('SSH key pair already exists.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->components->info('Generating SSH key pair...');
|
||||
if (!file_exists(storage_path('app/private/ssh'))) {
|
||||
if (! file_exists(storage_path('app/private/ssh'))) {
|
||||
$this->components->info('ssh directory does not exist. Creating it now...');
|
||||
mkdir(storage_path('app/private/ssh'), 0755, true);
|
||||
}
|
||||
|
||||
$result = Process::run(['ssh-keygen', '-t', 'ed25519', '-f', storage_path('app/private/ssh/id_ed25519'), '-N', '']);
|
||||
|
||||
if (!$result->successful()) {
|
||||
if (! $result->successful()) {
|
||||
$this->components->error('Failed to generate SSH key pair.');
|
||||
$this->line($result->output());
|
||||
$this->line($result->errorOutput());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user