-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace existing proxy config with
global-agent
(#572)
https://eaflood.atlassian.net/jira/software/projects/CMEA/boards/907?selectedIssue=CMEA-167 We previously fixed proxy support for requests going to the Rules Service, however this is also needed for S3 requests -- WRLS are currently having issues with sending bill runs in their local setup and this may be due to S3 requests failing for proxy reasons. While investigating how to configure the AWS SDK to use a proxy, we discovered that the tunnel package we are using for Rules Service proxying does not appear to be currently maintained. Researching a suitable alternative led us to global-agent, which would allow us to configure the proxy in .env and have it automatically used for all outgoing requests. We therefore implement this, and remove the existing proxy support entirely as it is no longer required. Note that the package uses the environment variable GLOBAL_AGENT_HTTP_PROXY -- the docs explain that some packages will automatically change their behaviour if HTTP_PROXY is set, so a different env var is used to prevent this from happening. One issue we ran into was that Nock does not correctly intercept requests during unit testing after GlobalAgent.bootstrap() has been called (regardless of whether or not a proxy is defined) -- we therefore check the environment is not test before we call it. For manual testing, we recommend enabling the nginix proxy in docker-compose.yml. Adding dns: 0.0.0.0 to the app definition is a quick way of requiring all traffic to go via the proxy and therefore verify that global-agent is working with both Rules Service and S3 requests. * Install and set up global-agent * Amend proxy details for manual testing * Remove proxy in `RequestRulesServiceChargeService` * Add globals to be ignored in testing * Removed unused proxy config setting * Remove unneeded tunnel package
- Loading branch information
Showing
8 changed files
with
238 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.