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

TT-12072 Configure Splunk client to use proxy from environment #818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonathanfoster
Copy link

This PR resolves issue #816 by configuring the Splunk client to use proxy settings from the environment.

Description

I set the proxy to http.ProxyFromEnvironment when initializing the Splunk client transport.

Related Issue

Motivation and Context

Support for HTTP_PROXY environment variables is required when running Tyk Pump in restricted environments that require all HTTP traffic to go through a proxy.

How This Has Been Tested

I included a unit test that verifies the proxy is not nil after initializing a Splunk client. I attempted to fully test the functionality by setting the HTTP_PROXY environment variable, but this caused other Splunk tests to fail. Since this fix leverages existing functionality from http.ProxyFromEnvironment, I don't think it's necessary to have end-to-end test coverage.

Technically one could set Proxy to something other than ProxyFromEnvironment and the test would pass so this is a gap. It would be ideal to verify the function pointers are the same, but I couldn't get it to work. I'm open to feedback on how to better handle this test.

Screenshots (if appropriate)

Not applicable.

Types of changes

  • 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 change)

Checklist

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If pulling from your own
    fork, don't request your master!
  • Make sure you are making a pull request against the master branch (left side). Also, you should start
    your branch off our latest master.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • go fmt -s
    • go vet

@caroltyk caroltyk changed the title Configure Splunk client to use proxy from environment TT-12072 Configure Splunk client to use proxy from environment May 3, 2024
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.

None yet

1 participant