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 @@ public function scopeWithProxy(): Builder
return $this->proxy->modelScope();
}
public function isLocalhost() {
if (isDev()) {
return $this->ip === 'coolify-testing-host';
}
return $this->ip === 'host.docker.internal';
}
public function checkServerRediness()
{
$serverUptimeCheckNumber = $this->unreachable_count;

View File

@ -49,11 +49,13 @@
<x-forms.input type="number" id="server.port" label="Port" required />
</div>
</div>
<div class="w-64">
<x-forms.checkbox instantSave
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>"
id="server.settings.is_cloudflare_tunnel" label="Cloudflare Tunnel" />
</div>
@if (!$server->isLocalhost())
<div class="w-64">
<x-forms.checkbox instantSave
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>"
id="server.settings.is_cloudflare_tunnel" label="Cloudflare Tunnel" />
</div>
@endif
</div>
@if ($server->isFunctional())