Skip to content

Commit

Permalink
Fix for integrations when processing the localhost node.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Jul 9, 2024
1 parent f546b0b commit 91845e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Models/IntegrationsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public function execute(int $id = 0)
// The (possibly) remote system has itself as a device, see if we can determine an actual IP
if (stripos($integration->attributes->attributes->url, '127.0.0.1') !== false or stripos($integration->attributes->attributes->url, 'localhost') !== false) {
// We're talking to ourselves
$ip = explode(',', $instance->config->ip);
$ip = explode(',', server_ip());
if (!empty($ip[0])) {
$device->devices->ip = $ip[0];
}
Expand Down Expand Up @@ -873,7 +873,7 @@ public function externalToInternal($integration, $external_devices)
$device->devices->ip = gethostbyname($device->devices->ip);
}
$fqdn = @gethostbyaddr($device->devices->ip);
if (empty($device->devices->dns_fqdn) and strpos($fqdn, '.') !== false) {
if (empty($device->devices->dns_fqdn) and !empty($fqdn) and strpos($fqdn, '.') !== false) {
$device->devices->dns_fqdn = $fqdn;
}
}
Expand Down

0 comments on commit 91845e2

Please sign in to comment.