Skip to content

Commit

Permalink
Ensure we create the keys directory if it doesnt already exist'
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkregel committed Dec 31, 2023
1 parent 7261f52 commit ec4ab55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Services/SshService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\Spork\Script;
use App\Models\User;
use Exception;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Str;

class SshService
Expand Down Expand Up @@ -103,6 +104,8 @@ public static function factory(string $host, User $user = null): Credential
if (empty($credential)) {
$randomName = Str::random(16);

(new Filesystem)->makeDirectory(storage_path('app/keys'), 0755, true, true);

$generatorService = new SshKeyGeneratorService(
privateKeyFile: $privateKeyFile = storage_path('app/keys/'.$randomName.'.key'),
publicKeyFile: $publicKeyFile = storage_path('app/keys/'.$randomName.'.pub'),
Expand Down

0 comments on commit ec4ab55

Please sign in to comment.