fix: sentinel config changes restarts sentinel

This commit is contained in:
Andras Bacsai
2024-10-22 14:10:36 +02:00
parent ac768e5313
commit 1f221d9791
5 changed files with 30 additions and 9 deletions

View File

@@ -97,7 +97,7 @@ class Form extends Component
try {
$this->server->settings->generateSentinelToken();
$this->server->settings->refresh();
$this->restartSentinel(notification: false);
// $this->restartSentinel(notification: false);
$this->dispatch('success', 'Token regenerated & Sentinel restarted.');
} catch (\Throwable $e) {
return handleError($e, $this);
@@ -161,6 +161,7 @@ class Form extends Component
public function instantSave()
{
try {
$this->validate();
refresh_server_connection($this->server->privateKey);
$this->validateServer(false);
@@ -169,13 +170,11 @@ class Form extends Component
$this->server->save();
$this->dispatch('success', 'Server updated.');
$this->dispatch('refreshServerShow');
$this->server->settings->save();
} catch (\Throwable $e) {
$this->server->settings->refresh();
return handleError($e, $this);
}
} finally {}
}
public function restartSentinel($notification = true)
@@ -185,10 +184,9 @@ class Form extends Component
$this->validate([
'server.settings.sentinel_custom_url' => 'required|url',
]);
$version = get_latest_sentinel_version();
StartSentinel::run($this->server, $version, true);
$this->server->restartSentinel();
if ($notification) {
$this->dispatch('success', 'Sentinel started.');
$this->dispatch('success', 'Sentinel restarted.');
}
} catch (\Throwable $e) {
return handleError($e, $this);