elixir-grpc / grpc

An Elixir implementation of gRPC
https://hex.pm/packages/grpc
Apache License 2.0
1.39k stars 212 forks source link

Accept URIs with scheme, add default SSL options for https, deprecate URLs without scheme #357

Closed v0idpwn closed 6 months ago

v0idpwn commented 6 months ago

This commit changes how addresses are handled by GRPC.Stub.connect/2.

First, by accepting URIs with scheme. Before, `http://localhost:50051" would cause a crash.

Second, by using the URI scheme to automatically set a GRPC credential if no GRPC credentials were provided. If we were to remove this part, we could at least validate that a GRPC credential was provided when the scheme is https.

~~Finally, by deprecating receiving URLs without scheme, such as localhost:50051. This isn't strictly necessary, but in my opinion makes things more consistent when we want to support both local sockets and remote urls.~~ Edit: the deprecation part was removed after review.

v0idpwn commented 6 months ago

Pushed a few commits doing (I believe) all suggestions :)