Merge pull request #12673 from zachauten/basic-auth
Add basic auth to curl download strategy, HOMEBREW_DOCKER_REGISTRY_TO…
This commit is contained in:
commit
d880fcc92a
@ -595,8 +595,14 @@ class CurlGitHubPackagesDownloadStrategy < CurlDownloadStrategy
|
||||
def initialize(url, name, version, **meta)
|
||||
meta ||= {}
|
||||
meta[:headers] ||= []
|
||||
token = Homebrew::EnvConfig.artifact_domain ? Homebrew::EnvConfig.docker_registry_token : "QQ=="
|
||||
meta[:headers] << "Authorization: Bearer #{token}" if token.present?
|
||||
meta[:headers] << if Homebrew::EnvConfig.artifact_domain && Homebrew::EnvConfig.docker_registry_token
|
||||
"Authorization: Bearer #{Homebrew::EnvConfig.docker_registry_token}"
|
||||
elsif Homebrew::EnvConfig.artifact_domain && Homebrew::EnvConfig.docker_registry_basic_auth_token
|
||||
"Authorization: Basic #{Homebrew::EnvConfig.docker_registry_basic_auth_token}"
|
||||
else
|
||||
# This QQ== is needed for the no-auth GitHub Packages default.
|
||||
"Authorization: Bearer QQ=="
|
||||
end
|
||||
super(url, name, version, meta)
|
||||
end
|
||||
|
||||
|
@ -174,8 +174,13 @@ module Homebrew
|
||||
description: "Use this GitHub personal access token when accessing the GitHub Packages Registry "\
|
||||
"(where bottles may be stored).",
|
||||
},
|
||||
HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN: {
|
||||
description: "Use this base64 encoded username and password for authenticating with a Docker registry " \
|
||||
"proxying GitHub Packages. If HOMEBREW_DOCKER_REGISTRY_TOKEN is set, it will be used instead.",
|
||||
},
|
||||
HOMEBREW_DOCKER_REGISTRY_TOKEN: {
|
||||
description: "Use this bearer token for authenticating with a Docker registry proxying GitHub Packages.",
|
||||
description: "Use this bearer token for authenticating with a Docker registry proxying GitHub Packages. " \
|
||||
"Preferred over HOMEBREW_DOCKER_REGISTRY_TOKEN_BASIC.",
|
||||
},
|
||||
HOMEBREW_GITHUB_PACKAGES_USER: {
|
||||
description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).",
|
||||
|
@ -2622,6 +2622,8 @@ module Homebrew::EnvConfig
|
||||
|
||||
def self.docker_registry_token(); end
|
||||
|
||||
def self.docker_registry_basic_auth_token(); end
|
||||
|
||||
def self.editor(); end
|
||||
|
||||
def self.fail_log_lines(); end
|
||||
|
Loading…
x
Reference in New Issue
Block a user