Skip to content
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

Fallback to getDefaultGateway() if "bridge" is unavailable. #2429

Merged
merged 1 commit into from Mar 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -218,7 +218,9 @@ static String resolveDockerHostIpAddress(DockerClient client, URI dockerHost) {
.filter(it -> it.getGateway() != null)
.findAny()
.map(Network.Ipam.Config::getGateway)
.orElse("localhost");
.orElseGet(() -> {
return DockerClientConfigUtils.getDefaultGateway().orElse("localhost");
});
Comment on lines +221 to +223

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.orElseGet(() -> {
return DockerClientConfigUtils.getDefaultGateway().orElse("localhost");
});
.orElseGet(() -> DockerClientConfigUtils.getDefaultGateway().orElse("localhost"));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thank you, it is done for readability :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thought you had multiline lambda to begin with, but ended up in oneliner later on forgetting to remove the braces :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, no, just I don't like "long short lambdas" (lol). Thanks for suggesting anyways! 👍

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long short lambdas
🤣

}
return "localhost";
default:
Expand Down