Skip to content

Commit

Permalink
fix: Add mac specific host for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Cawllec committed Jul 5, 2018
1 parent 56f387e commit 38b3cc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'open3'
require 'os'

Before do
find_default_docker_compose
Expand All @@ -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

0 comments on commit 38b3cc0

Please sign in to comment.