mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
refactoring
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Contracts\ServerType;
|
||||
use App\Enums\ServerStatus;
|
||||
use App\Facades\SSH;
|
||||
use App\Jobs\Installation\Upgrade;
|
||||
use App\Jobs\Server\CheckConnection;
|
||||
@ -232,9 +233,9 @@ public function install(): void
|
||||
// $this->team->notify(new ServerInstallationStarted($this));
|
||||
}
|
||||
|
||||
public function ssh(string $user = null, bool $defaultKeys = false): \App\Helpers\SSH|SSHFake
|
||||
public function ssh(string $user = null): \App\Helpers\SSH|SSHFake
|
||||
{
|
||||
return SSH::init($this, $user, $defaultKeys);
|
||||
return SSH::init($this, $user);
|
||||
}
|
||||
|
||||
public function installedPHPVersions(): array
|
||||
@ -323,7 +324,7 @@ public function getSshUserAttribute(string $value): string
|
||||
return config('core.ssh_user');
|
||||
}
|
||||
|
||||
public function sshKey(bool $default = false): array
|
||||
public function sshKey(): array
|
||||
{
|
||||
if (app()->environment() == 'testing') {
|
||||
return [
|
||||
@ -333,14 +334,6 @@ public function sshKey(bool $default = false): array
|
||||
];
|
||||
}
|
||||
|
||||
if ($default) {
|
||||
return [
|
||||
'public_key' => Str::replace("\n", '', File::get(storage_path(config('core.ssh_public_key_name')))),
|
||||
'public_key_path' => storage_path(config('core.ssh_public_key_name')),
|
||||
'private_key_path' => storage_path(config('core.ssh_private_key_name')),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'public_key' => Str::replace("\n", '', Storage::disk(config('core.key_pairs_disk'))->get($this->id.'.pub')),
|
||||
'public_key_path' => Storage::disk(config('core.key_pairs_disk'))->path($this->id.'.pub'),
|
||||
@ -385,4 +378,9 @@ public function getHostnameAttribute(): string
|
||||
{
|
||||
return Str::of($this->name)->slug();
|
||||
}
|
||||
|
||||
public function isReady(): bool
|
||||
{
|
||||
return $this->status == ServerStatus::READY;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user