Add isLocalhost method to Server model and

conditionally show Cloudflare Tunnel checkbox in
server form view
This commit is contained in:
Andras Bacsai 2023-11-16 14:28:26 +01:00
parent 81437e6822
commit fb42c43953
2 changed files with 13 additions and 5 deletions

View File

@ -112,6 +112,12 @@ class Server extends BaseModel
return $this->proxy->modelScope(); return $this->proxy->modelScope();
} }
public function isLocalhost() {
if (isDev()) {
return $this->ip === 'coolify-testing-host';
}
return $this->ip === 'host.docker.internal';
}
public function checkServerRediness() public function checkServerRediness()
{ {
$serverUptimeCheckNumber = $this->unreachable_count; $serverUptimeCheckNumber = $this->unreachable_count;

View File

@ -49,11 +49,13 @@
<x-forms.input type="number" id="server.port" label="Port" required /> <x-forms.input type="number" id="server.port" label="Port" required />
</div> </div>
</div> </div>
<div class="w-64"> @if (!$server->isLocalhost())
<x-forms.checkbox instantSave <div class="w-64">
helper="If you are using Cloudflare Tunnels, enable this. It will proxy all ssh requests to your server through Cloudflare.<span class='text-warning'>Coolify does not install/setup Cloudflare (cloudflared) on your server.</span>" <x-forms.checkbox instantSave
id="server.settings.is_cloudflare_tunnel" label="Cloudflare Tunnel" /> helper="If you are using Cloudflare Tunnels, enable this. It will proxy all ssh requests to your server through Cloudflare.<span class='text-warning'>Coolify does not install/setup Cloudflare (cloudflared) on your server.</span>"
</div> id="server.settings.is_cloudflare_tunnel" label="Cloudflare Tunnel" />
</div>
@endif
</div> </div>
@if ($server->isFunctional()) @if ($server->isFunctional())