lots of UI fixes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Actions\Proxy\InstallProxy;
|
||||
use App\Actions\Proxy\StartProxy;
|
||||
use App\Enums\ProxyTypes;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Bus\Queueable;
|
||||
@@ -15,30 +15,20 @@ class ProxyCheckJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public function __construct(protected Server|null $server = null)
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$container_name = 'coolify-proxy';
|
||||
if ($this->server) {
|
||||
ray('Checking proxy for server: ' . $this->server->name);
|
||||
$status = get_container_status(server: $this->server, container_id: $container_name);
|
||||
$servers = Server::isUsable()->whereNotNull('proxy')->get();
|
||||
foreach ($servers as $server) {
|
||||
$status = get_container_status(server: $server, container_id: $container_name);
|
||||
if ($status === 'running') {
|
||||
return;
|
||||
}
|
||||
resolve(InstallProxy::class)($this->server);
|
||||
} else {
|
||||
$servers = Server::whereRelation('settings', 'is_usable', true)->get();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
$status = get_container_status(server: $server, container_id: $container_name);
|
||||
if ($status === 'running') {
|
||||
continue;
|
||||
}
|
||||
resolve(InstallProxy::class)($server);
|
||||
continue;
|
||||
}
|
||||
resolve(StartProxy::class)($server);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
ray($th->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user