-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Allow HOMEBREW_CURLRC to specify a path for curl --config
#15853
Allow HOMEBREW_CURLRC to specify a path for curl --config
#15853
Conversation
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.
Thanks for the PR! Some comments.
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.
Great work here @clint-stripe! Excuse all the back-and-forth: just the first time we've had a config change like this so want to make sure we get it right first time 😎
Library/Homebrew/env_config.rb
Outdated
description: "If set to a path, pass it with `--config` when invoking `curl`(1). " \ | ||
"If set but _not_ a valid path, do not pass `--disable`, which disables the " \ | ||
"use of `.curlrc`.", |
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.
This is great. Wondering if this is the best approach or if we want to do something like "if set to 1
or true
"? @Homebrew/brew thoughts?
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.
That's a very fair question! The current handling of boolean: true
is #present?
, but it might be nice to enforce something stricter in this particular case.
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.
This is great. Wondering if this is the best approach or if we want to do something like "if set to
1
ortrue
"? @Homebrew/brew thoughts?
Starting with /
is probably sufficient to invoke the path-based logic, given it is unlikely someone does that in order to use it as a boolean and we won't ever support relative paths.
There's potentially also an argument that we could just let CURL_HOME
passthrough if HOMEBREW_CURLRC
is set rather than the double-purpose, but it maybe doesn't matter much and which is safer is largely situational.
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.
Starting with
/
is probably sufficient to invoke the path-based logic, given it is unlikely someone does that in order to use it as a boolean and we won't ever support relative paths.
Agreed, that works for me!
it "doesn't return `--config` when HOMEBREW_CURLRC is unset" do | ||
expect(curl_args(*args)).not_to include(a_string_starting_with("--config=")) | ||
end | ||
|
||
it "returns `--config` when HOMEBREW_CURLRC is a valid path" do | ||
Tempfile.create do |tmpfile| | ||
path = tmpfile.path | ||
ENV["HOMEBREW_CURLRC"] = path | ||
# We still expect --disable | ||
expect(curl_args(*args).first).to eq("--disable") | ||
expect(curl_args(*args).join(" ")).to include("--config #{path}") | ||
end | ||
ensure | ||
ENV["HOMEBREW_CURLRC"] = nil | ||
end |
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.
😍
Library/Homebrew/env_config.rb
Outdated
description: "If set to a path, pass it with `--config` when invoking `curl`(1). " \ | ||
"If set but _not_ a valid path, do not pass `--disable`, which disables the " \ | ||
"use of `.curlrc`.", |
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.
description: "If set to a path, pass it with `--config` when invoking `curl`(1). " \ | |
"If set but _not_ a valid path, do not pass `--disable`, which disables the " \ | |
"use of `.curlrc`.", | |
description: "If set to a full path (i.e. beginning with `/`, pass it with `--config` when invoking `curl`(1). " \ | |
"If set but _not_ a valid path, do not pass `--disable`, which disables the " \ | |
"use of `.curlrc`.", |
note this will fail brew style
: you'll need to fix up the strings locally. Once that's done, you've run brew generate-man-completions
and (ideally if your git-fu is sufficient) squashed it down to a single commit and CI is 🟢: this is ready to merge! Sorry for all the back and forth.
b06b619
to
a95f690
Compare
--config
Awesome, thank you so much for the quick reviews! (Also really appreciate I made that last change you suggested, fixed up the line lengths, and squashed. CI looks green! |
Co-authored-by: Mike McQuaid <[email protected]> Co-authored-by: Carlo Cabrera <[email protected]>
1f64cad
to
4ade935
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.
Thanks so much for your first contribution (hopefully of many)! Without people like you submitting PRs we couldn't run this project. You rock, @clint-stripe!
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?We're using a custom
HOMEBREW_ARTIFACT_DOMAIN
that requires some additional flags in.curlrc
. We would like to setHOMEBREW_CURLRC
and the value forCURL_HOME
in/etc/homebrew/brew.env
to support this without relying on the user's.curlrc
.