wip
This commit is contained in:
24
app/Actions/Proxy/CheckProxySettingsInSync.php
Normal file
24
app/Actions/Proxy/CheckProxySettingsInSync.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Actions\Proxy;
|
||||||
|
|
||||||
|
use App\Enums\ActivityTypes;
|
||||||
|
use App\Enums\ProxyTypes;
|
||||||
|
use App\Models\Server;
|
||||||
|
use Spatie\Activitylog\Models\Activity;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
class CheckProxySettingsInSync
|
||||||
|
{
|
||||||
|
public function __invoke(Server $server)
|
||||||
|
{
|
||||||
|
// @TODO What is the mechanism to make sure setting in sync?
|
||||||
|
$folder_name = match ($server->extra_attributes->proxy) {
|
||||||
|
ProxyTypes::TRAEFIK_V2->value => 'proxy',
|
||||||
|
};
|
||||||
|
|
||||||
|
return instantRemoteProcess([
|
||||||
|
'if [ -d "projects/'.$folder_name.'" ]; then echo "true"; else echo "false"; fi',
|
||||||
|
], $server);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Server;
|
namespace App\Http\Livewire\Server;
|
||||||
|
|
||||||
|
use App\Actions\Proxy\CheckProxySettingsInSync;
|
||||||
use App\Actions\Proxy\InstallProxy;
|
use App\Actions\Proxy\InstallProxy;
|
||||||
use App\Enums\ActivityTypes;
|
use App\Enums\ActivityTypes;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
@@ -32,10 +33,9 @@ class Proxy extends Component
|
|||||||
|
|
||||||
public function checkProxySettingsInSync()
|
public function checkProxySettingsInSync()
|
||||||
{
|
{
|
||||||
|
$status = resolve(CheckProxySettingsInSync::class)($this->server);
|
||||||
|
|
||||||
$this->is_check_proxy_complete = true;
|
$this->is_check_proxy_complete = true;
|
||||||
$this->is_proxy_settings_in_sync = true;
|
$this->is_proxy_settings_in_sync = $status === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<label>
|
<label>
|
||||||
<div>Edit config file</div>
|
<div>Edit config file</div>
|
||||||
<textarea cols="45" rows="25"></textarea>
|
<textarea cols="45" rows="6"></textarea>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user