This commit is contained in:
Andras Bacsai 2023-06-14 08:51:30 +02:00
parent 1584a48b11
commit 35b9ce4ff0
3 changed files with 13 additions and 1 deletions

View File

@ -13,6 +13,7 @@ public function up(): void
{
Schema::create('instance_settings', function (Blueprint $table) {
$table->id();
$table->string('public_ip_address')->nullable();
$table->string('fqdn')->nullable();
$table->string('wildcard_domain')->nullable();
$table->string('default_redirect_404')->nullable();

View File

@ -13,6 +13,7 @@
use App\Models\StandaloneDocker;
use App\Models\Team;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Storage;
class ProductionSeeder extends Seeder
@ -105,5 +106,16 @@ public function run(): void
'server_id' => 0,
]);
}
try {
$ip = Process::run('curl -4s https://ifconfig.io')->output;
$ip = trim($ip);
$ip = filter_var($ip, FILTER_VALIDATE_IP);
$settings = InstanceSettings::get();
if ($settings->public_ip_address !== $ip) {
$settings->update(['public_ip_address' => $ip]);
}
} catch (\Exception $e) {
echo "Error: {$e->getMessage()}\n";
}
}
}

View File

@ -17,6 +17,5 @@
<div class="stat-value">{{ $resources }}</div>
<div class="stat-desc">Applications, databases, etc...</div>
</div>
</div>
</x-layout>