mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
refactoring
This commit is contained in:
@ -20,7 +20,6 @@ class AWS extends AbstractProvider
|
||||
public function createValidationRules(array $input): array
|
||||
{
|
||||
$rules = [
|
||||
'size' => 'required|numeric|min:15|max:16000',
|
||||
'os' => 'required|in:'.implode(',', OperatingSystem::getValues()),
|
||||
];
|
||||
// plans
|
||||
@ -36,6 +35,8 @@ public function createValidationRules(array $input): array
|
||||
}
|
||||
$rules['region'] = 'required|in:'.implode(',', $regions);
|
||||
|
||||
Log::info("AWS Creation Rules", $rules);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
@ -60,7 +61,6 @@ public function data(array $input): array
|
||||
return [
|
||||
'plan' => $input['plan'],
|
||||
'region' => $input['region'],
|
||||
'size' => $input['size'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
namespace App\ServerProviders;
|
||||
|
||||
use App\ValidationRules\RestrictedIPAddressesRule;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class Custom extends AbstractProvider
|
||||
@ -57,7 +59,14 @@ public function regions(): array
|
||||
|
||||
public function create(): void
|
||||
{
|
||||
$this->generateKeyPair();
|
||||
File::copy(
|
||||
storage_path(config('core.ssh_private_key_name')),
|
||||
Storage::disk(config('core.key_pairs_disk'))->path($this->server->id)
|
||||
);
|
||||
File::copy(
|
||||
storage_path(config('core.ssh_public_key_name')),
|
||||
Storage::disk(config('core.key_pairs_disk'))->path($this->server->id.'.pub')
|
||||
);
|
||||
}
|
||||
|
||||
public function isRunning(): bool
|
||||
|
@ -6,6 +6,7 @@
|
||||
use App\Exceptions\ServerProviderError;
|
||||
use App\Notifications\FailedToDeleteServerFromProvider;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Linode extends AbstractProvider
|
||||
{
|
||||
@ -103,6 +104,7 @@ public function create(): void
|
||||
if (count($errors) > 0) {
|
||||
$msg = $errors[0]['reason'];
|
||||
}
|
||||
Log::error("Linode error", $errors);
|
||||
throw new ServerProviderError($msg);
|
||||
}
|
||||
$this->server->ip = $create->json()['ipv4'][0];
|
||||
|
Reference in New Issue
Block a user