Files
coolify/database/seeders/ServerSettingSeeder.php
T
Andras BacsaiandClaude Opus 5.5 b13ecb0542 chore(seeding): seed railpack examples from new repo layout
Move all git examples into ApplicationSeeder on railpack, using the
reorganized coollabsio/coolify-examples main branch, and drop the
separate Railpack Examples project. Add DEV_SEED_IP to set the IP for
seeded sslip.io domains (e.g. a Tailscale IP).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:26:19 +02:00

38 lines
1012 B
PHP

<?php
namespace Database\Seeders;
use App\Models\Server;
use Illuminate\Database\Seeder;
use InvalidArgumentException;
class ServerSettingSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$server_2 = Server::find(0)->load(['settings']);
$server_2->settings->wildcard_domain = 'http://'.self::sslipHost();
$server_2->settings->is_build_server = false;
$server_2->settings->is_usable = true;
$server_2->settings->is_reachable = true;
$server_2->settings->save();
}
/**
* The sslip.io host for seeded domains, based on DEV_SEED_IP (default 127.0.0.1).
*/
public static function sslipHost(): string
{
$ip = config('constants.coolify.dev_seed_ip');
if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
throw new InvalidArgumentException("DEV_SEED_IP must be an IPv4 address, got: {$ip}");
}
return "{$ip}.sslip.io";
}
}