From 38b3cc0a1afa1e17005244ca779afe34a105e8e6 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 5 Jul 2018 17:12:38 +0100 Subject: [PATCH] fix: Add mac specific host for docker --- Gemfile | 1 + features/support/env.rb | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index c6774981f..87e38b2fc 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ end group :maze, optional: true do gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner' if RUBY_VERSION >= '2.0.0' + gem 'os' end gemspec diff --git a/features/support/env.rb b/features/support/env.rb index 80c62f68e..c58b7ddcb 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,4 +1,5 @@ require 'open3' +require 'os' Before do find_default_docker_compose @@ -18,9 +19,11 @@ def output_logs end def current_ip - # Parses the output of `ifconfig` to retreive the host IP for docker to talk to - # Breaks compatability with Windows - ip_addr = `ifconfig | grep -Eo 'inet (addr:)?([0-9]*\\\.){3}[0-9]*' | grep -v '127.0.0.1'` - ip_list = /((?:[0-9]*\.){3}[0-9]*)/.match(ip_addr) - ip_list.captures.first + if OS.mac? + 'host.docker.internal' + else + ip_addr = `ifconfig | grep -Eo 'inet (addr:)?([0-9]*\\\.){3}[0-9]*' | grep -v '127.0.0.1'` + ip_list = /((?:[0-9]*\.){3}[0-9]*)/.match(ip_addr) + ip_list.captures.first + end end