rpm-software-management/libdnf

Make libdnf read environment variables HTTP_PROXY and HTTPS_PROXY for global proxy configuration

elyezer opened this issue · 4 comments

Given that libdnf is used by rpm-ostree we found ourselves having to configure proxy= for each repo we have. It would a lot more convenient if libdnf ready the environment variables HTTP_PROXY and HTTPS_PROXY as the default proxy config if available and use everywhere. It should still be able to be overridden by repo specific proxy option.

Hi, I can't seem to reproduce this issue at first glance. What I did:

mitmproxy # run mitmproxy in a separate shell, then:

export http_proxy=http://localhost:8080
export https_proxy=https://localhost:8080
dnf reposync

DNF is hitting the proxy, and using libdnf directly should do the same.

Is it possible you're writing it uppercase as HTTP_PROXY instead of http_proxy? HTTPS_PROXY should work in uppercase, but http_proxy must be lowercase: https://curl.se/libcurl/c/libcurl-env.html

libdnf should also respect the proxy option in the [main] section of its configuration, so that's another alternative to configuring it per-repository:
https://dnf.readthedocs.io/en/latest/conf_ref.html?highlight=proxy#options-for-both-main-and-repo

If that doesn't help, would you mind providing a small reproducer?

@evan-goode thanks for the response there, trying to address your questions:

It was all lower case and it was throughout the rpm-ostree upgrade that it was found. Then going over coreos/rpm-ostree#762 one of the comments mentioned about using libdnf and it could be a problem here. I will start a new ostree based system and see if I can come up with a reproducer. In the mean time I will leave this open and will update here as soon as possible.

@evan-goode I did some more research and it seems that the reason I was facing this issue was because of coreos/rpm-ostree#208, so even if I set the env var I had to define it on the daemon for the rpm-ostree. Sorry for the unnecessary noise and thank you so much for double checking.

No worries, glad you sorted it!