Adds proxy configuration option via environment variables with global agent fixes issue #56 #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The node-red tibber api modules depends on tibber-api to source the data, and tibber-api depends on ws (web service) to source the data.
Adding proxy support is very easy to achieve by simply importing global-agent and setting the right environment variables,
As the documentation of ws states in order to use a proxy:
This is exactly what http-agent does, allowing configuration via environment variables.
How to test the proxy feature
On your development environment deploy your favorite proxy server using docker, such as:
Now you have a proxy running on 127.0.0.1:3128 We will now use it as:
We are asking global-agent to forward http and https requests via this proxy.
A tibber-feed will start working via the proxy. I.e. stop the proxy and watch your feed break.
There are multiple confirmations possible all which can be done via environment variables:
For details check the global agent documentation
Fixes issue #56