fix: localhost
This commit is contained in:
parent
f77df5b732
commit
3ea462efc9
@ -89,7 +89,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
if (!$this->createdServer) {
|
if (!$this->createdServer) {
|
||||||
return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
||||||
}
|
}
|
||||||
return $this->validateServer();
|
return $this->validateServer('localhost');
|
||||||
} elseif ($type === 'remote') {
|
} elseif ($type === 'remote') {
|
||||||
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
||||||
if ($this->privateKeys->count() > 0) {
|
if ($this->privateKeys->count() > 0) {
|
||||||
@ -185,7 +185,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
|
|
||||||
$this->validateServer();
|
$this->validateServer();
|
||||||
}
|
}
|
||||||
public function validateServer()
|
public function validateServer(?string $type = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$customErrorMessage = "Server is not reachable:";
|
$customErrorMessage = "Server is not reachable:";
|
||||||
@ -197,24 +197,30 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
throw new \Exception('No Docker Engine or older than 23 version installed.');
|
throw new \Exception('No Docker Engine or older than 23 version installed.');
|
||||||
}
|
}
|
||||||
$customErrorMessage = "Cannot create Server or Private Key. Please try again.";
|
$customErrorMessage = "Cannot create Server or Private Key. Please try again.";
|
||||||
$createdPrivateKey = PrivateKey::create([
|
if ($type !== 'localhost') {
|
||||||
'name' => $this->privateKeyName,
|
$createdPrivateKey = PrivateKey::create([
|
||||||
'description' => $this->privateKeyDescription,
|
'name' => $this->privateKeyName,
|
||||||
'private_key' => $this->privateKey,
|
'description' => $this->privateKeyDescription,
|
||||||
'team_id' => currentTeam()->id
|
'private_key' => $this->privateKey,
|
||||||
]);
|
'team_id' => currentTeam()->id
|
||||||
$server = Server::create([
|
]);
|
||||||
'name' => $this->remoteServerName,
|
$server = Server::create([
|
||||||
'ip' => $this->remoteServerHost,
|
'name' => $this->remoteServerName,
|
||||||
'port' => $this->remoteServerPort,
|
'ip' => $this->remoteServerHost,
|
||||||
'user' => $this->remoteServerUser,
|
'port' => $this->remoteServerPort,
|
||||||
'description' => $this->remoteServerDescription,
|
'user' => $this->remoteServerUser,
|
||||||
'private_key_id' => $createdPrivateKey->id,
|
'description' => $this->remoteServerDescription,
|
||||||
'team_id' => currentTeam()->id,
|
'private_key_id' => $createdPrivateKey->id,
|
||||||
]);
|
'team_id' => currentTeam()->id,
|
||||||
$server->settings->is_reachable = true;
|
]);
|
||||||
$server->settings->is_usable = true;
|
$server->settings->is_reachable = true;
|
||||||
$server->settings->save();
|
$server->settings->is_usable = true;
|
||||||
|
$server->settings->save();
|
||||||
|
} else {
|
||||||
|
$this->createdServer->settings->update([
|
||||||
|
'is_reachable' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
$this->getProxyType();
|
$this->getProxyType();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user