fix
This commit is contained in:
parent
7ce31c77c5
commit
4df928a660
@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use App\Models\InstanceSettings;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Process;
|
||||
|
||||
class InstanceSettingsSeeder extends Seeder
|
||||
{
|
||||
@ -23,5 +24,23 @@ class InstanceSettingsSeeder extends Seeder
|
||||
'smtp_from_name' => 'Coolify',
|
||||
]
|
||||
]);
|
||||
try {
|
||||
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
|
||||
$ipv4 = trim($ipv4);
|
||||
$ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP);
|
||||
$settings = InstanceSettings::get();
|
||||
if (is_null($settings->public_ipv4) && $ipv4) {
|
||||
$settings->update(['public_ipv4' => $ipv4]);
|
||||
}
|
||||
$ipv6 = Process::run('curl -6s https://ifconfig.io')->output();
|
||||
$ipv6 = trim($ipv6);
|
||||
$ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP);
|
||||
$settings = InstanceSettings::get();
|
||||
if (is_null($settings->public_ipv6) && $ipv6) {
|
||||
$settings->update(['public_ipv6' => $ipv6]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
echo "Error: {$e->getMessage()}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,18 +107,18 @@ class ProductionSeeder extends Seeder
|
||||
]);
|
||||
}
|
||||
try {
|
||||
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output;
|
||||
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
|
||||
$ipv4 = trim($ipv4);
|
||||
$ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP);
|
||||
$settings = InstanceSettings::get();
|
||||
if (is_null($settings->public_ipv4)) {
|
||||
if (is_null($settings->public_ipv4) && $ipv4) {
|
||||
$settings->update(['public_ipv4' => $ipv4]);
|
||||
}
|
||||
$ipv6 = Process::run('curl -6s https://ifconfig.io')->output;
|
||||
$ipv6 = Process::run('curl -6s https://ifconfig.io')->output();
|
||||
$ipv6 = trim($ipv6);
|
||||
$ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP);
|
||||
$settings = InstanceSettings::get();
|
||||
if (is_null($settings->public_ipv6)) {
|
||||
if (is_null($settings->public_ipv6) && $ipv6) {
|
||||
$settings->update(['public_ipv6' => $ipv6]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user