mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-19 04:15:57 +00:00
feat: add Hetzner Cloud server linking for manually-added servers
Allow manually-added servers to be linked to Hetzner Cloud instances by matching IP address. Once linked, servers gain power controls and status monitoring. Changes: - Add getServers() and findServerByIp() methods to HetznerService - Add Hetzner linking UI section to Server General page - Add unit tests for new HetznerService methods 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eef0cc94cc
commit
67b1db9254
4 files changed
+345
No files matched your search
@@ -161,4 +161,30 @@ class HetznerService
|
||||
{
|
||||
$this->request('delete', "/servers/{$serverId}");
|
||||
}
|
||||
|
||||
public function getServers(): array
|
||||
{
|
||||
return $this->requestPaginated('get', '/servers', 'servers');
|
||||
}
|
||||
|
||||
public function findServerByIp(string $ip): ?array
|
||||
{
|
||||
$servers = $this->getServers();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
// Check IPv4
|
||||
$ipv4 = data_get($server, 'public_net.ipv4.ip');
|
||||
if ($ipv4 === $ip) {
|
||||
return $server;
|
||||
}
|
||||
|
||||
// Check IPv6 (Hetzner returns the full /64 block)
|
||||
$ipv6 = data_get($server, 'public_net.ipv6.ip');
|
||||
if ($ipv6 && str_starts_with($ip, rtrim($ipv6, '/'))) {
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user