chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
69 stars 16 forks source link

does not work behind a proxy (windows) #82

Closed maku closed 1 year ago

maku commented 1 year ago

I tried tool-sync on 2 machines. On the machine which uses a proxy the tool sync command does not work...

Is there a way to config tool-sync for using a proxy?

chshersh commented 1 year ago

Hi @maku 👋🏻

Currently tool-sync doesn't support proxy. I'm using the ureq Rust crate for querying an API. I see that it supports proxies:

But I'm not quite sure how it should be used 🤔 Could you help me out here and provide some more details? What CLI and UX would you expect from tool-sync?

Or, alternatively, how would you change the following curl command to download an asset if you wanted to use proxies?

curl \
    -H "Accept: application/vnd.github+json"  \
    https://api.github.com/repos/chshersh/tool-sync/releases/assets/76226041
maku commented 1 year ago

I would suggest to provide a configuration option for the proxy string in the .tool.toml file

e.g. proxy = http://127.0.0.1:8080

and pass the data to ureq when available

MitchellBerend commented 1 year ago

@maku are you working on this? Otherwise I will try and implement this. Im actually running into the same issue right now.

maku commented 1 year ago

@MitchellBerend no i do not work on this

MitchellBerend commented 1 year ago

I have tried playing around with with this issue and its actually harder than I thought.

Some thoughts I have already:

There should probably be a global proxy option] but I can also see different tools having different proxies. A new flag --proxy seems like a nice way to adhoc add a proxy for a single run just like --config.

What do you guys think?

Example configs

# This configuration is automatically generated by tool-sync 0.2.0
# https://github.com/chshersh/tool-sync
#######################################
#
# Installation directory for all the tools:
store_directory = "$HOME/rust/tool-sync/bin"
proxy = "http://10.10.0.1:8000"
#
# tool-sync provides native support for some of the tools without the need to
# configure them. Uncomment all the tools you want to install with a single
...
[github]  # Name of the tool (new or one of the hardcoded to override default settings)
    owner     = "cli"  # GitHub repository owner
    repo      = "cli"     # GitHub repository name
    exe_name  = "gh"          # Executable name inside the asset
#
#     Uncomment to download a specific version or tag.
#     Without this tag latest will be used
#     tag       = "13.0.0"
    proxy = "http://10.10.0.1:8000

#     Asset name to download on linux OSes
    asset_name.linux = "linux_amd64.tar.gz"