site = $site; } /** * @throws Throwable */ public function handle(): void { $this->site->server->ssh()->exec( new GenerateSshKeyCommand($this->site->ssh_key_name), 'generate-ssh-key', $this->site->id ); $this->site->ssh_key = $this->site->server->ssh()->exec( new ReadSshKeyCommand($this->site->ssh_key_name), 'read-public-key', $this->site->id ); $this->site->save(); $this->site->sourceControl()->provider()->deployKey( $this->site->domain.'-key-' . $this->site->id, $this->site->repository, $this->site->ssh_key ); } }