mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 01:41:36 +00:00
define storage instances with phpdoc
This commit is contained in:
parent
31bd146239
commit
2d7f225ff2
@ -17,9 +17,12 @@ public function update(Service $service, string $ini): void
|
||||
{
|
||||
$tmpName = Str::random(10).strtotime('now');
|
||||
try {
|
||||
Storage::disk('local')->put($tmpName, $ini);
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk('local');
|
||||
|
||||
$storageDisk->put($tmpName, $ini);
|
||||
$service->server->ssh('root')->upload(
|
||||
Storage::disk('local')->path($tmpName),
|
||||
$storageDisk->path($tmpName),
|
||||
"/etc/php/$service->version/cli/php.ini"
|
||||
);
|
||||
$this->deleteTempFile($tmpName);
|
||||
|
@ -343,10 +343,13 @@ public function sshKey(): array
|
||||
];
|
||||
}
|
||||
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
|
||||
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'),
|
||||
'private_key_path' => Storage::disk(config('core.key_pairs_disk'))->path((string) $this->id),
|
||||
'public_key_path' => $storageDisk->path($this->id.'.pub'),
|
||||
'private_key_path' => $storageDisk->path((string) $this->id),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -164,10 +164,12 @@ private function createKeyPair(): void
|
||||
$result = $this->ec2Client->createKeyPair([
|
||||
'KeyName' => $keyName,
|
||||
]);
|
||||
Storage::disk(config('core.key_pairs_disk'))->put((string) $this->server->id, $result['KeyMaterial']);
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
$storageDisk->put((string) $this->server->id, $result['KeyMaterial']);
|
||||
generate_public_key(
|
||||
Storage::disk(config('core.key_pairs_disk'))->path((string) $this->server->id),
|
||||
Storage::disk(config('core.key_pairs_disk'))->path($this->server->id.'.pub'),
|
||||
$storageDisk->path((string) $this->server->id),
|
||||
$storageDisk->path($this->server->id.'.pub'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ public function __construct(?Server $server = null)
|
||||
|
||||
protected function generateKeyPair(): void
|
||||
{
|
||||
generate_key_pair(Storage::disk(config('core.key_pairs_disk'))->path((string) $this->server->id));
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
generate_key_pair($storageDisk->path((string) $this->server->id));
|
||||
}
|
||||
}
|
||||
|
@ -59,13 +59,15 @@ public function regions(): array
|
||||
|
||||
public function create(): void
|
||||
{
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
File::copy(
|
||||
storage_path(config('core.ssh_private_key_name')),
|
||||
Storage::disk(config('core.key_pairs_disk'))->path($this->server->id)
|
||||
$storageDisk->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')
|
||||
$storageDisk->path($this->server->id.'.pub')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,9 @@ public function regions(): array
|
||||
public function create(): void
|
||||
{
|
||||
// generate key pair
|
||||
generate_key_pair(Storage::disk(config('core.key_pairs_disk'))->path((string) $this->server->id));
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
generate_key_pair($storageDisk->path((string) $this->server->id));
|
||||
|
||||
$createSshKey = Http::withToken($this->server->serverProvider->credentials['token'])
|
||||
->post($this->apiUrl.'/ssh-keys', [
|
||||
|
@ -39,8 +39,8 @@
|
||||
'ssh_user' => env('SSH_USER', 'vito'),
|
||||
'ssh_public_key_name' => env('SSH_PUBLIC_KEY_NAME', 'ssh-public.key'),
|
||||
'ssh_private_key_name' => env('SSH_PRIVATE_KEY_NAME', 'ssh-private.pem'),
|
||||
'logs_disk' => env('SERVER_LOGS_DISK', 'server-logs-local'),
|
||||
'key_pairs_disk' => env('KEY_PAIRS_DISK', 'key-pairs-local'),
|
||||
'logs_disk' => env('SERVER_LOGS_DISK', 'server-logs-local'), // should to be FilesystemAdapter storage
|
||||
'key_pairs_disk' => env('KEY_PAIRS_DISK', 'key-pairs-local'), // should to be FilesystemAdapter storage
|
||||
|
||||
/*
|
||||
* General
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
'disks' => [
|
||||
|
||||
// should be FilesystemAdapter
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div>
|
||||
<x-primary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'create-project')">
|
||||
{{ __('Create') }}
|
||||
{{ __('Connect') }}
|
||||
</x-primary-button>
|
||||
|
||||
<x-modal name="create-project" :show="$open">
|
||||
|
Loading…
x
Reference in New Issue
Block a user