Skip to content

Added configuration option for proxy usage #609

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

Merged
merged 7 commits into from
Apr 16, 2020

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Mar 6, 2020

This PR makes a bunch of changes:

  • use downloader.SetDefaultConfig() to set globally the user-agent: this allows to avoid passing headers back and forth
  • previously in the core update-index command user agent headers wasn't set when downloading: with the global downloader.SetDefaultConfig(...) this is no more a problem.
  • added support for network proxy configuration
  • refactored the function that generates the user-agent to add a subcomponent part (we use it in the daemon mode).
  • that showed we make an http API call in board list without using downloader library, so it ignores the global network settings. I've added a TODO for missing proxy usage.

@cmaglie cmaglie self-assigned this Mar 6, 2020
@rsora rsora added this to the 0.10.0 milestone Mar 6, 2020
Copy link
Contributor

@rsora rsora left a comment

Choose a reason for hiding this comment

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

Nice!
For the records, this PR follows bugst/go-downloader#2

@rsora rsora added the status: in progress Work is in progress on this label Apr 9, 2020
@cmaglie cmaglie force-pushed the proxy-implementation branch from c95253b to f5b386e Compare April 12, 2020 21:58
@rsora rsora modified the milestones: 0.10.0, 0.11.0 Apr 14, 2020
cmaglie added 7 commits April 15, 2020 17:11
This change allows to not pass-trough the downloader configuration from
function to function everywhere (and sometime we forget to pass it for
example in the "core update-index" command).
It's better to read the network configuration before each http request so
in case it is changed using "Settings" functions in daemon mode the changes
are immediately applied.
@cmaglie
Copy link
Member Author

cmaglie commented Apr 16, 2020

In the meantime I've changed the implementaion.

  • we do not use downloader.SetDefaultConfig() anymore
  • now we have a command.GetDownloaderConfig() method that returns a downloader.Config based on the current configuration stored in viper. This way any change on the configuration is immediately reflected on subsequent downloads

@cmaglie cmaglie force-pushed the proxy-implementation branch from f5b386e to 16e0871 Compare April 16, 2020 11:22
@cmaglie cmaglie merged commit 6903076 into arduino:master Apr 16, 2020
@rsora rsora modified the milestones: 0.11.0, 0.10.0 Apr 16, 2020
@cmaglie cmaglie deleted the proxy-implementation branch April 16, 2020 11:35
@rsora rsora removed the status: in progress Work is in progress on this label Apr 16, 2020
rsora pushed a commit that referenced this pull request Apr 16, 2020
* Use downloader.SetDefaultConfig() to set user-agent for the arduino-cli

This change allows to not pass-trough the downloader configuration from
function to function everywhere (and sometime we forget to pass it for
example in the "core update-index" command).

* Add support for network proxy configuration

* Cosmetic: added blank space in configuration/defaults.go

* Update go-downloader to 1.2.0

* Refactored function to generate user-agent

* Added a TODO for missing proxy usage in board list API query

* Partially revert global network configuration.

It's better to read the network configuration before each http request so
in case it is changed using "Settings" functions in daemon mode the changes
are immediately applied.
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