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

fix: dgraph connection should ignore key for localhost #793

Merged
merged 3 commits into from
Mar 19, 2025

Conversation

mattjohnsonpint
Copy link
Member

Description

When connecting to a dgraph instance on localhost, the key value should be ignored.

Checklist

All PRs should check the following boxes:

  • I have given this PR a title using the
    Conventional Commits syntax, leading with fix:,
    feat:, chore:, ci:, etc.
    • The title should also be used for the commit message when the PR is squashed and merged.
  • I have formatted and linted my code with Trunk, per the instructions in
    the contributing guide.

If the PR includes a code change, then also check the following boxes. (If not, then delete the
next section.)

  • I have added an entry to the CHANGELOG.md file.
    • Add to the "UNRELEASED" section at the top of the file, creating one if it doesn't yet exist.
    • Be sure to include the link to this PR, and please sort the section numerically by PR number.
  • I have manually tested the new or modified code, and it appears to behave correctly.
  • I have added or updated unit tests where appropriate, if applicable.

@Copilot Copilot bot review requested due to automatic review settings March 19, 2025 01:23
@mattjohnsonpint mattjohnsonpint requested a review from a team as a code owner March 19, 2025 01:23
Copy link

linear bot commented Mar 19, 2025

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the dgraph connection logic so that when connecting to a dgraph instance on localhost the key is ignored, and it ensures proper gRPC options are applied based on the target.

  • Adjusts gRPC dial options to use insecure credentials for localhost
  • Applies client TLS credentials and conditionally adds per-RPC credentials when a key is present for non-localhost connections
  • Updates the CHANGELOG to document the fix

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
CHANGELOG.md Updates the change log with the fix description
runtime/dgraphclient/registry.go Modifies connection logic to ignore the key for localhost and properly handle TLS and authentication for non-localhost connections
Comments suppressed due to low confidence (1)

runtime/dgraphclient/registry.go:109

  • [nitpick] Consider extracting the hostname from connection.GrpcTarget into a local variable to improve readability and avoid potential errors if the target string format changes.
if strings.Split(connection.GrpcTarget, ":")[0] == "localhost" {

ryanfoxtyler
ryanfoxtyler previously approved these changes Mar 19, 2025
@mattjohnsonpint mattjohnsonpint merged commit 594b10c into main Mar 19, 2025
54 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-3129 branch March 19, 2025 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants