Skip to content

Commit

Permalink
Enable default discovery population under MacOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Aug 7, 2024
1 parent 877002c commit 042fef2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Helpers/network_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ function server_ip()
{
$ip_address_array = array();

# MacOS
if (php_uname('s') == 'Darwin') {
$command = "ifconfig | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d'/'";
exec($command, $output, $return_var);
if ($return_var == 0) {
foreach ($output as $line) {
$ip_address_array[] = trim((string)$line);
}
}
}

# linux
if (php_uname('s') == 'Linux') {
$command = "ip addr | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d'/'";
Expand Down

0 comments on commit 042fef2

Please sign in to comment.