mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-28 02:06:37 -04:00
fix(domains): limit instance addresses to localhost DNS hints
This commit is contained in:
@@ -716,6 +716,63 @@ it('lists dns entries for domains that still need dns and omits working configur
|
||||
->not->toContain('app.example.com');
|
||||
});
|
||||
|
||||
it('does not use instance network addresses for dns entries on a remote server', function () {
|
||||
InstanceSettings::get()->update([
|
||||
'public_ipv4' => '198.51.100.20',
|
||||
'public_ipv6' => '2001:db8::20',
|
||||
]);
|
||||
$this->application->update(['fqdn' => 'https://app.example.com']);
|
||||
|
||||
$component = Livewire::test(Domains::class, ['application' => $this->application->fresh()]);
|
||||
$records = $component->instance()->dnsRecordHints();
|
||||
|
||||
expect($records)->toBe([
|
||||
[
|
||||
'type' => 'A',
|
||||
'name' => 'app.example.com',
|
||||
'value' => '203.0.113.10',
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it('uses instance network addresses for dns entries on the localhost server', function () {
|
||||
InstanceSettings::get()->update([
|
||||
'public_ipv4' => '198.51.100.20',
|
||||
'public_ipv6' => '2001:db8::20',
|
||||
]);
|
||||
$localhost = Server::factory()->create([
|
||||
'id' => 0,
|
||||
'team_id' => $this->team->id,
|
||||
'private_key_id' => $this->server->private_key_id,
|
||||
'ip' => 'localhost',
|
||||
]);
|
||||
$destination = StandaloneDocker::withoutEvents(fn () => StandaloneDocker::forceCreate([
|
||||
'uuid' => (string) Str::uuid(),
|
||||
'name' => 'localhost-docker',
|
||||
'network' => 'coolify-localhost',
|
||||
'server_id' => $localhost->id,
|
||||
]));
|
||||
$this->application->update([
|
||||
'destination_id' => $destination->id,
|
||||
'fqdn' => 'https://app.example.com',
|
||||
]);
|
||||
|
||||
$component = Livewire::test(Domains::class, ['application' => $this->application->fresh()]);
|
||||
|
||||
expect($component->instance()->dnsRecordHints())->toBe([
|
||||
[
|
||||
'type' => 'A',
|
||||
'name' => 'app.example.com',
|
||||
'value' => '198.51.100.20',
|
||||
],
|
||||
[
|
||||
'type' => 'AAAA',
|
||||
'name' => 'app.example.com',
|
||||
'value' => '2001:db8::20',
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it('shows cloudflare domain connect only on cloud with a key', function () {
|
||||
config([
|
||||
'constants.coolify.self_hosted' => false,
|
||||
|
||||
@@ -280,6 +280,24 @@ it('lists dns entries for service hosts that still need dns', function () {
|
||||
->not->toContain('web.example.com');
|
||||
});
|
||||
|
||||
it('does not use instance network addresses for service dns entries on a remote server', function () {
|
||||
InstanceSettings::get()->update([
|
||||
'public_ipv4' => '198.51.100.20',
|
||||
'public_ipv6' => '2001:db8::20',
|
||||
]);
|
||||
$this->apiApp->update(['fqdn' => 'https://api.example.com']);
|
||||
|
||||
$component = Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])]);
|
||||
|
||||
expect($component->instance()->dnsRecordHints())->toBe([
|
||||
[
|
||||
'type' => 'A',
|
||||
'name' => 'api.example.com',
|
||||
'value' => '203.0.113.10',
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it('persists a service redirect when its dropdown changes', function () {
|
||||
$this->webApp->update(['fqdn' => 'https://web.example.com', 'redirect' => 'both']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user