feat(v5): add application ingress routing

This commit is contained in:
Andras Bacsai committed 2026-06-20 15:08:45 +02:00
1 parent 86156b6f7a
commit ad0bcc8a4a
16 files changed
+763 -235

No files matched your search

+35
View File
@@ -21,6 +21,30 @@ class FluxClient
return is_array($data) ? $data : [];
}
/**
* @param array<int, array{name: string, caddyfile: string}> $apps
*/
public function applyCaddyIngress(string $hostId, string $caddyfile, array $apps = [], string $meshNetwork = 'coolify-default-mesh'): string
{
$payload = $this->dispatch($hostId, [
'type' => 'apply_caddy_ingress',
'caddyfile' => $caddyfile,
'apps' => $apps,
'mesh_network' => $meshNetwork,
]);
return $this->output($payload, 'Caddy ingress applied.');
}
public function stopCaddyIngress(string $hostId): string
{
$payload = $this->dispatch($hostId, [
'type' => 'stop_caddy_ingress',
]);
return $this->output($payload, 'Caddy ingress stopped.');
}
/**
* @param array<string, mixed> $command
* @return array<string, mixed>
@@ -84,4 +108,15 @@ class FluxClient
return $payload;
}
/**
* @param array<string, mixed> $payload
*/
private function output(array $payload, string $fallback): string
{
$data = $payload['data'] ?? [];
$output = is_array($data) && is_string($data['output'] ?? null) ? $data['output'] : '';
return $output !== '' ? $output : $fallback;
}
}