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

Add a configuration validator and options formatter for EndpointOptions #4024

Merged
merged 2 commits into from
Feb 13, 2018

Conversation

ReubenBond
Copy link
Member

@benjaminpetit this might also need a default value for AdvertisedIPAddress, but I'm not sure if the default should be Any, Localhost, or something else.

@@ -76,31 +104,29 @@ public static class EndpointOptionsExtensions

internal static IPEndPoint GetPublicSiloEndpoint(this EndpointOptions options)
{
return new IPEndPoint(options.AdvertisedIPAddress, options.SiloPort);
return options?.AdvertisedIPAddress != null
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this check is needed since the validator should throw before that.

We could also throw an exception here just in case, currently the silo cannot work without setting the AdvertisedIPAddress. Same comment for GetPublicProxyEndpoint

@benjaminpetit
Copy link
Member

this might also need a default value for AdvertisedIPAddress, but I'm not sure if the default should be Any, Localhost, or something else.

I think we should do like in 1.5, by default take one non-localhost ip address that we found, with ConfigUtilities.ResolveIPAddress

@@ -62,13 +63,15 @@ public class SiloHostBuilderTests
[Fact]
public void SiloHostBuilder_AssembliesTest()
{
var builder = (ISiloHostBuilder) new SiloHostBuilder()
.ConfigureServices(services => services.AddSingleton<IMembershipTable, NoOpMembershipTable>());
var builder = new SiloHostBuilder().ConfigureEndpoints(IPAddress.Any, 9999, 0)
Copy link
Member

Choose a reason for hiding this comment

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

Sorry to have missed that, but I think we should throws at validation when trying to use IPAddress.Any for published ip address. I don't think it make sense?

@benjaminpetit
Copy link
Member

LGTM as is, I can add some checks and add default value in another PR if you want

@ReubenBond
Copy link
Member Author

@benjaminpetit sounds good to me. This is just a drive-by PR, since I hit the issue of not having a default endpoint value in another PR

@sergeybykov
Copy link
Contributor

@ReubenBond Please rebase.

@benjaminpetit benjaminpetit merged commit 8d2f296 into dotnet:master Feb 13, 2018
@ReubenBond ReubenBond deleted the validate-endpoints branch February 13, 2018 23:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants