fix: sentinel config changes restarts sentinel
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Actions\Server\InstallDocker;
|
||||
use App\Actions\Server\StartSentinel;
|
||||
use App\Enums\ProxyTypes;
|
||||
use App\Jobs\PullSentinelImageJob;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -1265,4 +1266,13 @@ $schema://$host {
|
||||
{
|
||||
return str($this->ip)->contains(':');
|
||||
}
|
||||
|
||||
public function restartSentinel()
|
||||
{
|
||||
try {
|
||||
StartSentinel::dispatch($this,true);
|
||||
} catch (\Throwable $e) {
|
||||
loggy('Error restarting Sentinel: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,18 @@ class ServerSetting extends Model
|
||||
loggy('Error creating server setting: '.$e->getMessage());
|
||||
}
|
||||
});
|
||||
static::updated(function ($setting) {
|
||||
if (
|
||||
$setting->isDirty('sentinel_token') ||
|
||||
$setting->isDirty('sentinel_custom_url') ||
|
||||
$setting->isDirty('sentinel_metrics_refresh_rate_seconds') ||
|
||||
$setting->isDirty('sentinel_metrics_history_days') ||
|
||||
$setting->isDirty('sentinel_push_interval_seconds')
|
||||
) {
|
||||
loggy('Restarting Sentinel');
|
||||
$setting->server->restartSentinel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function generateSentinelToken(bool $save = true)
|
||||
|
||||
Reference in New Issue
Block a user