From 8307d3da90122f3fc6a7ab54dbe203faebcfd413 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 20 Aug 2024 20:38:18 +0100 Subject: [PATCH] proxy: use for updater don't know how I missed before. --- main.go | 3 ++- updater.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 8083563..94c38cc 100644 --- a/main.go +++ b/main.go @@ -557,6 +557,7 @@ func start(asDaemon, firstCall bool) { } if app.proxyEnabled { + app.updater.SetTransport(app.proxyTransport) app.jf.SetTransport(app.proxyTransport) for _, c := range app.thirdPartyServices { c.SetTransport(app.proxyTransport) @@ -682,7 +683,7 @@ func flagPassed(name string) (found bool) { } // @title jfa-go internal API -// @version 0.5.1 +// @version 0.5.2 // @description API for the jfa-go frontend // @contact.name Harvey Tindall // @contact.email hrfee@hrfee.dev diff --git a/updater.go b/updater.go index 41bc19f..8320e2a 100644 --- a/updater.go +++ b/updater.go @@ -130,6 +130,11 @@ type Updater struct { binary string } +// SetTransport sets the http.Transport to use for requests. Can be used to set a proxy. +func (ud *Updater) SetTransport(t *http.Transport) { + ud.httpClient.Transport = t +} + func newUpdater(buildroneURL, namespace, repo, version, commit, buildType string) *Updater { // fmt.Printf(`Updater intializing with "%s", "%s", "%s", "%s", "%s", "%s"\n`, buildroneURL, namespace, repo, version, commit, buildType) bType := off