fix: convert startProxy to action
This commit is contained in:
parent
61f58fa30f
commit
93b202bde4
@ -6,11 +6,13 @@
|
|||||||
use App\Enums\ProxyTypes;
|
use App\Enums\ProxyTypes;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
use Spatie\Activitylog\Models\Activity;
|
use Spatie\Activitylog\Models\Activity;
|
||||||
|
|
||||||
class StartProxy
|
class StartProxy
|
||||||
{
|
{
|
||||||
public function __invoke(Server $server, bool $async = true): Activity|string
|
use AsAction;
|
||||||
|
public function handle(Server $server, bool $async = true): Activity|string
|
||||||
{
|
{
|
||||||
$proxyType = data_get($server,'proxy.type');
|
$proxyType = data_get($server,'proxy.type');
|
||||||
if ($proxyType === 'none') {
|
if ($proxyType === 'none') {
|
||||||
|
@ -27,7 +27,7 @@ public function startProxy()
|
|||||||
SaveConfiguration::run($this->server);
|
SaveConfiguration::run($this->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
$activity = resolve(StartProxy::class)($this->server);
|
$activity = StartProxy::run($this->server);
|
||||||
$this->emit('newMonitorActivity', $activity->id);
|
$this->emit('newMonitorActivity', $activity->id);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
|
@ -82,7 +82,7 @@ public function handle(): void
|
|||||||
})->first();
|
})->first();
|
||||||
if (!$foundProxyContainer) {
|
if (!$foundProxyContainer) {
|
||||||
if ($this->server->isProxyShouldRun()) {
|
if ($this->server->isProxyShouldRun()) {
|
||||||
resolve(StartProxy::class)($this->server, false);
|
StartProxy::run($this->server, false);
|
||||||
$this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
$this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user