added proxy for git everywhere
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
|||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
"github.com/go-git/go-git/v5/storage/memory"
|
"github.com/go-git/go-git/v5/storage/memory"
|
||||||
|
gitProxy "github.com/go-git/go-git/v5/plumbing/transport"
|
||||||
|
|
||||||
// Random
|
// Random
|
||||||
xj "github.com/basgys/goxml2json"
|
xj "github.com/basgys/goxml2json"
|
||||||
@@ -4238,6 +4239,19 @@ func runInitEs(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTP_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTP_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTPS_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTPS_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
branch := os.Getenv("SHUFFLE_DOWNLOAD_AUTH_BRANCH")
|
branch := os.Getenv("SHUFFLE_DOWNLOAD_AUTH_BRANCH")
|
||||||
if len(branch) > 0 && branch != "master" && branch != "main" {
|
if len(branch) > 0 && branch != "master" && branch != "main" {
|
||||||
cloneOptions.ReferenceName = plumbing.ReferenceName(branch)
|
cloneOptions.ReferenceName = plumbing.ReferenceName(branch)
|
||||||
@@ -4282,6 +4296,18 @@ func runInitEs(ctx context.Context) {
|
|||||||
cloneOptions := &git.CloneOptions{
|
cloneOptions := &git.CloneOptions{
|
||||||
URL: apis,
|
URL: apis,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTP_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTP_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTPS_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTPS_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
_, err = git.Clone(storer, fs, cloneOptions)
|
_, err = git.Clone(storer, fs, cloneOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed loading repo %s into memory: %s", apis, err)
|
log.Printf("[ERROR] Failed loading repo %s into memory: %s", apis, err)
|
||||||
|
|||||||
@@ -3940,6 +3940,19 @@ func LoadSpecificApps(resp http.ResponseWriter, request *http.Request) {
|
|||||||
cloneOptions.ReferenceName = plumbing.ReferenceName(tmpBody.Branch)
|
cloneOptions.ReferenceName = plumbing.ReferenceName(tmpBody.Branch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTP_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTP_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Getenv("HTTPS_PROXY") != "" {
|
||||||
|
cloneOptions.ProxyOptions = gitProxy.ProxyOptions{
|
||||||
|
URL: os.Getenv("HTTPS_PROXY"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME: Better auth.
|
// FIXME: Better auth.
|
||||||
if len(tmpBody.Field1) > 0 && len(tmpBody.Field2) > 0 {
|
if len(tmpBody.Field1) > 0 && len(tmpBody.Field2) > 0 {
|
||||||
cloneOptions.Auth = &http2.BasicAuth{
|
cloneOptions.Auth = &http2.BasicAuth{
|
||||||
|
|||||||
Reference in New Issue
Block a user