-
Notifications
You must be signed in to change notification settings - Fork 14
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
Respect the PROXY_ENABLED environment variable #146
Conversation
2dd7299
to
a62d4ac
Compare
a62d4ac
to
b63bf38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This is a special environment variable set in SUSE systems and that is managed by tools like YAST. The usage of this environment variable is not standard and hence the net/http/httputil library does not support it. Therefore, this commit adds an extra check for this environment variable when setting up the HTTP client. See SUSE/connect@b2758ad Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
b63bf38
to
0256cd5
Compare
@skazi0 @djoreilly note that I have basically reverted to the original code from this PR. That is, we don't use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
if !proxyEnabled() { | ||
return nil, nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO something like this would be easier to understand
if strings.ToLower(strings.TrimSpace(os.Getenv("PROXY_ENABLED"))) == "no" {
return nil, nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that it can also be "n". And users might have mistakenly set "false" or "f", and I don't think is unreasonable to support it (plus, in SUSEConnect
ruby we also allow all this as you can see on the referenced commit). With this in mind, the comparison is not that easy and putting it in as a separate function reads well while allowing to hide how exactly we determine all this from the caller perspective.
Description
This is a special environment variable set in SUSE systems and that is managed by tools like YAST. The usage of this environment variable is not standard and hence the net/http/httputil library does not support it.
Therefore, this commit adds an extra check for this environment variable when setting up the HTTP client.
See SUSE/connect@b2758ad
How to test it
PROXY_ENABLED
is respected. That is, even ifHTTP_PROXY
has been set, settingPROXY_ENABLED
tofalse
will make SUSEConnect to ignore the setup.