-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add auth header support. #52
base: master
Are you sure you want to change the base?
Conversation
This makes it possible to authenticate with the gitlab or github API by specifying a `PRIVATE-TOKEN` or `Authorization` header with the http request. Now you can download the ansible source tarball and md5 directly from the gitlab package registry using the gitlab API.
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 contribution! I have some nits, and I will merge this PR once they are addressed.
@@ -87,7 +87,8 @@ func init() { | |||
pflag.String("http-proto", "https", "Set to 'http' if necessary") | |||
pflag.String("http-user", "", "HTTP username for pulling the remote file") | |||
pflag.String("http-pass", "", "HTTP password for pulling the remote file") | |||
|
|||
pflag.String("http-header-name", "", "HTTP header name") |
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.
nit: Let's fill it with context. "HTTP header name for pulling the remote file"
@@ -87,7 +87,8 @@ func init() { | |||
pflag.String("http-proto", "https", "Set to 'http' if necessary") | |||
pflag.String("http-user", "", "HTTP username for pulling the remote file") | |||
pflag.String("http-pass", "", "HTTP password for pulling the remote file") | |||
|
|||
pflag.String("http-header-name", "", "HTTP header name") | |||
pflag.String("http-header-value", "", "HTTP header value") |
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.
nit: Let's fill it with context. "HTTP header value for pulling the remote file"
testEmptyChecksumUrl = "" | ||
testChecksumUrlPath = "custom.txt.md5" | ||
testEmptyChecksumUrl = "" | ||
testChecksumUrlPath = "custom.txt.md5" | ||
|
||
testHashlessFilename = "nohash.txt" | ||
testHashlessText = []byte("Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.") |
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.
Can we include the new fields in the test?
Will update whein I find some time, rather busy atm! Thanks for the review! |
This makes it possible to authenticate with the gitlab or github API by specifying a
PRIVATE-TOKEN
orAuthorization
header with the http request.Now you can download the ansible source tarball and md5 directly from the gitlab or github package registry using the gitlab API.
example config: