fix: sslip for localhost

This commit is contained in:
Andras Bacsai
2023-09-28 10:53:00 +02:00
parent 199881c596
commit b046a3e9f7
6 changed files with 24 additions and 50 deletions

View File

@@ -1,6 +1,7 @@
<?php
use App\Models\InstanceSettings;
use App\Models\Server;
use App\Models\Team;
use App\Models\User;
use App\Notifications\Channels\DiscordChannel;
@@ -393,3 +394,15 @@ function data_get_str($data, $key, $default = null): Stringable
$str = data_get($data, $key, $default) ?? $default;
return Str::of($str);
}
function sslip(Server $server)
{
if (isDev()) {
return "127.0.0.1.sslip.io";
}
if ($server->ip === 'host.docker.internal') {
$baseIp = base_ip();
return "$baseIp.sslip.io";
}
return "{$server->ip}.sslip.io";
}