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 GossipOverHttps option to EventStoreClientConnectivitySettings #51

Merged
merged 3 commits into from
Jul 1, 2020

Conversation

shaan1337
Copy link
Member

@shaan1337 shaan1337 commented Jun 29, 2020

Fixes #50

This PR allows the dotnet gRPC client to connect to a cluster running with --insecure (related PR: EventStore/EventStore#2556)

@shaan1337 shaan1337 marked this pull request as ready for review June 30, 2020 07:00
thefringeninja
thefringeninja previously approved these changes Jun 30, 2020
Copy link
Member

@hayley-jean hayley-jean left a comment

Choose a reason for hiding this comment

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

Looks good and I've tested locally. I just have one comment about the naming of UseHttps

@@ -20,12 +20,14 @@ public class EventStoreClientConnectivitySettings {
public DnsEndPoint[]? DnsGossipSeeds { get; set; }
public IPEndPoint[]? IpGossipSeeds { get; set; }
public TimeSpan GossipTimeout { get; set; }
public bool UseHttps { get; set; } = true;
Copy link
Member

@hayley-jean hayley-jean Jun 30, 2020

Choose a reason for hiding this comment

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

Perhaps we should rename UseHttps to make it more obvious that it only applies to gossip seeds, as it doesn't affect single node connection defaults right now.

As it stands, it looks like I could use the following to connect to a single node running with defaults and --insecure:

ConnectivitySettings =
{
    UseHttps = false
}

But the above results in SSL errors. I have to set the uri instead :

ConnectivitySettings =
{
    Address = new Uri("http://localhost:2113")
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The other thing we can do here is infer that from Address.

Copy link
Member Author

Choose a reason for hiding this comment

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

@hayley-jean @thefringeninja good catch thanks , i'll try to see if we can infer it from Address so that it can be used both for single nodes and clusters

Copy link
Member Author

@shaan1337 shaan1337 Jul 1, 2020

Choose a reason for hiding this comment

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

@hayley-jean @thefringeninja what do you think about:

		private bool _useHttps = true;
		public bool UseHttps {
			get{
				return _useHttps;
			}
			set{
				_useHttps = value;
				Address = new UriBuilder{
					Scheme = _useHttps ? Uri.UriSchemeHttps : Uri.UriSchemeHttp,
					Host = Address.Host,
					Port = Address.Port
				}.Uri;
			}
		}

the good thing is that it would modify the Address only if UseHttps is set by the user

Copy link
Member Author

Choose a reason for hiding this comment

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

@hayley-jean @thefringeninja after discussing with @pgermishuys , GossipOverHttps might be a better name - technically speaking, it is not completely valid since we also use the flag to connect the the node (not only for gossip info) but it seems more intuitive from a user perspective and is consistent with GossipSeeds and GossipTimeout options

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in this commit: 983861d

@shaan1337 shaan1337 changed the title Add UseHttps option to EventStoreClientConnectivitySettings Add GossipOverHttps option to EventStoreClientConnectivitySettings Jul 1, 2020
@thefringeninja thefringeninja merged commit 23ad2ae into master Jul 1, 2020
@thefringeninja thefringeninja deleted the use-https-option branch July 1, 2020 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow client to connect to cluster using --insecure
3 participants