Skip to content

Commit

Permalink
Remove default port from grpc ChannelOptions
Browse files Browse the repository at this point in the history
URIs should always specify a port.  If they don't, a `ValueError` will
be raised.

Signed-off-by: Sahas Subramanian <[email protected]>
  • Loading branch information
shsms committed Sep 3, 2024
1 parent 13f223e commit 0ffbe17
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/frequenz/client/base/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class SslOptions:
class ChannelOptions:
"""Options for a gRPC channel."""

port: int = 9090
"""The port number to connect to."""

ssl: SslOptions = SslOptions()
"""SSL options for the channel."""

Expand Down Expand Up @@ -110,9 +107,10 @@ def parse_grpc_uri(

options = _parse_query_params(uri, parsed_uri.query)

target = (
parsed_uri.netloc if parsed_uri.port else f"{parsed_uri.netloc}:{defaults.port}"
)
if not parsed_uri.port:
raise ValueError(f"The gRPC URI '{uri}' doesn't specify a port.")

target = parsed_uri.netloc

ssl = defaults.ssl.enabled if options.ssl is None else options.ssl
if ssl:
Expand Down

0 comments on commit 0ffbe17

Please sign in to comment.