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

do not override port if defined in host #362

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

haruska
Copy link
Contributor

@haruska haruska commented Jul 3, 2024

Problem

For an Index gRPC connection, port 443 is blindly added to the configured host for setting up the endpoint. A user should be able to specify a port for connection.

Solution

This PR will no longer append ":443" to the configured gRPC endpoint if a colon is already present in the host configuration.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Unit tests were updated for omitting and including a port in the host config. Verified that the client could connect to an Index on a port other than 443.

@haruska haruska requested review from austin-denoble and jhamon July 3, 2024 00:05
Copy link
Contributor

@austin-denoble austin-denoble 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, thanks for tackling this! We should maybe audit how we're handling the URL in the Java and Go repos also, they could maybe use a similar treatment.

@@ -84,8 +84,10 @@ def stub_class(self):
pass

def _endpoint(self):
grpcHost = self.config.host.replace("https://", "")
return self._endpoint_override if self._endpoint_override else f"{grpcHost}:443"
grpc_host = self.config.host.replace("https://", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this needs to be expanded to handle "http" as well. 🤔

Not that you need to fix that here, I just realized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably needs to be overhauled in general. I'll have another refactor to make it more holistic once it's needed for REST. This only fixes gRPC data plane config for now.

@haruska haruska merged commit af01fdf into main Jul 3, 2024
83 checks passed
@haruska haruska deleted the allow_port_override branch July 3, 2024 15:15
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.

2 participants