Skip to content

Commit

Permalink
Connection config improvements + L11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Mar 5, 2024
1 parent 756175c commit 0fecea0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-22.04]
php: [8.3, 8.2, 8.1]
laravel: [10.*]
php: [8.3, 8.2]
laravel: [11.*, 10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ A package to write Shell scripts like Blade Components and run them locally or o

It's the *magic* of Inertia.js with the *simplicity* of Blade. [Splade](https://github.com/protonemedia/laravel-splade) provides a super easy way to build Single Page Applications using Blade templates. Besides that magic SPA-feeling, it comes with more than ten components to sparkle your app and make it interactive, all without ever leaving Blade.

## Want to see this package in action?

Check out [Eddy Server Management](https://github.com/protonemedia/eddy-server-management), our open-source solution for Server Provisioning and Zero-Downtime PHP Deployment!

## Installation

This package requires Laravel 10 and PHP 8.1 or higher. You can install the package via composer:
This package requires Laravel 10 and PHP 8.2 or higher. You can install the package via composer:

```bash
composer require protonemedia/laravel-task-runner
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
}
],
"require": {
"php": "^8.1|^8.2|^8.3",
"illuminate/process": "^10.0",
"php": "^8.2|^8.3",
"illuminate/process": "^10.0|^11.0",
"spatie/laravel-package-tools": "^1.13.0",
"spatie/temporary-directory": "^2.1"
},
Expand All @@ -27,7 +27,7 @@
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.0",
"orchestra/testbench": "^8.0",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpunit/phpunit": "^10.4"
Expand Down
26 changes: 22 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function fromArray(array $config): static
{
$username = $config['username'] ?: '';

$scriptPath = $config['script_path'] ?: null;
$scriptPath = $config['script_path'] ?? null;

if ($scriptPath) {
$scriptPath = rtrim($scriptPath, '/');
Expand All @@ -90,18 +90,36 @@ public static function fromArray(array $config): static
$privateKey = $privateKey();
}

if (! $privateKey && array_key_exists('private_key_path', $config)) {
$privateKey = file_get_contents($config['private_key_path']);
$privateKeyPath = $config['private_key_path'] ?? null;

if (! $privateKey && $privateKeyPath) {
$privateKey = file_get_contents($privateKeyPath);
}

return new static(
$instance = new static(
host: $config['host'] ?: null,
port: $config['port'] ?: null,
username: $username ?: null,
privateKey: $privateKey,
scriptPath: $scriptPath,
proxyJump: $config['proxy_jump'] ?? null,
);

if ($privateKeyPath) {
$instance->setPrivateKeyPath($privateKeyPath);
}

return $instance;
}

/**
* Sets the path to the private key.
*/
public function setPrivateKeyPath(string $privateKeyPath): self
{
$this->privateKeyPath = $privateKeyPath;

return $this;
}

/**
Expand Down

0 comments on commit 0fecea0

Please sign in to comment.