-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set localhost if gethostbyname() is un-resolvable #34
base: master
Are you sure you want to change the base?
Conversation
… the 'host' can't be resolved either via DNS or via local-hosts file. Setting 'localhost' under such cases.
Codecov Report
@@ Coverage Diff @@
## master #34 +/- ##
==========================================
- Coverage 82.78% 81.81% -0.97%
==========================================
Files 2 2
Lines 151 154 +3
Branches 18 18
==========================================
+ Hits 125 126 +1
- Misses 22 24 +2
Partials 4 4
Continue to review full report at Codecov.
|
Appreciate the pull request, but I'm not entirely sure I'm comfortable adding this to master for the following reason:
Rather than adding a default source that might be misleading and not addressing the problem, I think I'd rather prefer a behaviour that forces a fail fast and points out what the problem is and how to fix it so users can remediate root problems at source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read comment on addressing problem at source. As stated in my comment I'm not convinced that adding a default when network has the wrong configuration is the right thing to do here. I'd rather prefer to address the root problem by using a fail fast approach and helping the user to understand what the issue is and pointing him in a direction on how to solve it, for example.
Ran into a similar problem today, and came across this SO answer for determining your IP address. https://stackoverflow.com/a/28950776 This worked for me, even though I completely agree with the fail fast approach, however, I think we can add some robustness to the library if we develop a simple function that runs through a variety a different methods and then ultimately fails if none are successful. |
@dougiep16: That makes sense to me as well. @yamadmia: If you opt for this approach, l'd suggest considering moving that part of the code (finding out info on the current running host) to a different file so we try to keep the handler clean. Most of other methods to find out the IP address might be platform dependent. Whatever we do, we must ensure the handler remains platform independent. |
seems still reasonable for mac users |
… the 'host' can't be resolved either via DNS or via local-hosts file. Setting 'localhost' under such cases.