fix(proxy): set Traefik network labels for compose services

Add the Coolify network label when no user-selected Traefik network exists, while preserving custom labels for applications and services.
This commit is contained in:
Andras Bacsai
2026-08-15 18:31:32 +02:00
parent 006b1b2b74
commit 1c25b58dc8
4 changed files with 154 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
it('adds the Coolify network when the user did not select a Traefik network', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.enable=true',
]), 'app-uuid');
expect($labels->values()->all())->toContain('traefik.docker.network=app-uuid');
});
it('preserves a user-selected Traefik network', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.enable=true',
'traefik.docker.network=custom-network',
]), 'app-uuid');
expect($labels->values()->all())
->toContain('traefik.docker.network=custom-network')
->not->toContain('traefik.docker.network=app-uuid');
});
it('treats a bare user-provided Traefik network label as authoritative', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.docker.network',
]), 'app-uuid');
expect($labels->values()->all())
->toContain('traefik.docker.network')
->not->toContain('traefik.docker.network=app-uuid');
});