Skip to content

Commit

Permalink
Merge pull request #16 from ziming/allow-private-key
Browse files Browse the repository at this point in the history
Allow private key to be specified
  • Loading branch information
freekmurze authored Oct 7, 2022
2 parents b287750 + 604098f commit 6e5163b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
* The package will cd to the given path before executing the given command.
*/
'path' => env('REMOTE_PATH'),

/*
* Optional. Path to the private key on your computer if your remote server requires it.
*/
'private_key_path' => env('REMOTE_PRIVATE_KEY_PATH'),
]
],
];
4 changes: 4 additions & 0 deletions src/Commands/RemoteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public function handle()
})
->usePort($hostConfig->port);

if ($hostConfig->privateKeyPath) {
$ssh->usePrivateKey($hostConfig->privateKeyPath);
}

$commandsToExecute = $this->getCommandsToExecute($hostConfig);

if ($this->failsConfirmationPrompt($hostConfig)) {
Expand Down
1 change: 1 addition & 0 deletions src/Config/HostConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public function __construct(
public int $port,
public string $user,
public string $path,
public ?string $privateKeyPath = null,
) {
}
}

0 comments on commit 6e5163b

Please sign in to comment.