summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-08-18 21:10:39 +0800
committerGitHub <noreply@github.com>2021-08-18 21:10:39 +0800
commitf9acad82ca231b2a094879e53134b0d91815ddf0 (patch)
tree31207c11f9d2c7135bfb31cbf1388d94724f1ddc /services
parent422c30d3157d9f06af43901a1c7978dd25ca12a5 (diff)
downloadgitea-f9acad82ca231b2a094879e53134b0d91815ddf0.tar.gz
gitea-f9acad82ca231b2a094879e53134b0d91815ddf0.zip
Add proxy settings and support for migration and webhook (#16704)
* Add proxy settings and support for migration and webhook * Fix default value * Add newline for example ini * Add lfs proxy support * Fix lint * Follow @zeripath's review * Fix git clone * Fix test * missgin http requests for proxy * use empty Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'services')
-rw-r--r--services/mirror/mirror_pull.go2
-rw-r--r--services/mirror/mirror_push.go6
-rw-r--r--services/webhook/deliver.go3
3 files changed, 6 insertions, 5 deletions
diff --git a/services/mirror/mirror_pull.go b/services/mirror/mirror_pull.go
index 89b5df4638..5bd08fa9bf 100644
--- a/services/mirror/mirror_pull.go
+++ b/services/mirror/mirror_pull.go
@@ -196,7 +196,7 @@ func runSync(ctx context.Context, m *models.Mirror) ([]*mirrorSyncResult, bool)
if m.LFS && setting.LFS.StartServer {
log.Trace("SyncMirrors [repo: %-v]: syncing LFS objects...", m.Repo)
ep := lfs.DetermineEndpoint(remoteAddr.String(), m.LFSEndpoint)
- if err = repo_module.StoreMissingLfsObjectsInRepository(ctx, m.Repo, gitRepo, ep); err != nil {
+ if err = repo_module.StoreMissingLfsObjectsInRepository(ctx, m.Repo, gitRepo, ep, false); err != nil {
log.Error("Failed to synchronize LFS objects for repository: %v", err)
}
}
diff --git a/services/mirror/mirror_push.go b/services/mirror/mirror_push.go
index de81303689..c1f53196e3 100644
--- a/services/mirror/mirror_push.go
+++ b/services/mirror/mirror_push.go
@@ -134,7 +134,7 @@ func runPushSync(ctx context.Context, m *models.PushMirror) error {
defer gitRepo.Close()
ep := lfs.DetermineEndpoint(remoteAddr.String(), "")
- if err := pushAllLFSObjects(ctx, gitRepo, ep); err != nil {
+ if err := pushAllLFSObjects(ctx, gitRepo, ep, false); err != nil {
return util.NewURLSanitizedError(err, remoteAddr, true)
}
}
@@ -176,8 +176,8 @@ func runPushSync(ctx context.Context, m *models.PushMirror) error {
return nil
}
-func pushAllLFSObjects(ctx context.Context, gitRepo *git.Repository, endpoint *url.URL) error {
- client := lfs.NewClient(endpoint)
+func pushAllLFSObjects(ctx context.Context, gitRepo *git.Repository, endpoint *url.URL, skipTLSVerify bool) error {
+ client := lfs.NewClient(endpoint, skipTLSVerify)
contentStore := lfs.NewContentStore()
pointerChan := make(chan lfs.PointerBlob)
diff --git a/services/webhook/deliver.go b/services/webhook/deliver.go
index 8243fde1bb..d0e115b136 100644
--- a/services/webhook/deliver.go
+++ b/services/webhook/deliver.go
@@ -25,6 +25,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/setting"
"github.com/gobwas/glob"
)
@@ -260,7 +261,7 @@ var (
func webhookProxy() func(req *http.Request) (*url.URL, error) {
if setting.Webhook.ProxyURL == "" {
- return http.ProxyFromEnvironment
+ return proxy.Proxy()
}
once.Do(func() {