From 9926767a288293a5bfb3982c5d075f68dc52226d Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Sat, 4 Mar 2023 12:39:29 +0000 Subject: [PATCH] updated proxy.proxy_url -> proxy.url --- README.md | 4 ++-- web/config.tmpl | 2 +- web/scraping.go | 4 ++-- web/web.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 137d4fc..20b1118 100644 --- a/README.md +++ b/README.md @@ -196,10 +196,10 @@ schedule: ## Proxy -The config can be used to proxy HTTP/HTTPS requests through a proxy: +An HTTP/HTTPS proxy can be configured in the config or through the `GOWATCH_PROXY_URL` environment variable: ``` proxy: - proxy_url: http://proxy.com:1234 + url: http://proxy.com:1234 ``` This will not work for requests made through Lua filters or Browserless but when using the docker image, the `HTTP_PROXY` and `HTTPS_PROXY` environment variables can also be used which will route all traffic through the proxy: ``` diff --git a/web/config.tmpl b/web/config.tmpl index fff7110..267fa17 100644 --- a/web/config.tmpl +++ b/web/config.tmpl @@ -42,7 +42,7 @@ database: schedule: "@every 1d" path: "/backup/{{.Year}}_{{.Month}}_{{.Day}}T{{.Hour}}-{{.Minute}}-{{.Second}}.gzip" # https://pkg.go.dev/time available proxy: - proxy_url: http://proxy.com:1234 + url: http://proxy.com:1234 browserless: url: http://your.browserless:1234 gin: diff --git a/web/scraping.go b/web/scraping.go index bd2d20f..9d7e5c7 100644 --- a/web/scraping.go +++ b/web/scraping.go @@ -324,8 +324,8 @@ func getFilterResultURLs(filter *Filter, urlCache map[string]string, debug bool) func getURLContent(filter *Filter, fetchURL string) (string, error) { var httpClient *http.Client - if viper.IsSet("proxy.proxy_url") { - proxyUrl, err := url.Parse(viper.GetString("proxy.proxy_url")) + if viper.IsSet("proxy.url") { + proxyUrl, err := url.Parse(viper.GetString("proxy.url")) if err != nil { return "", err } diff --git a/web/web.go b/web/web.go index 98cf640..9d8c2fd 100644 --- a/web/web.go +++ b/web/web.go @@ -104,10 +104,10 @@ func (web *Web) addCronJobIfCronFilter(filter *Filter, startup bool) { web.cronWatch[filter.ID] = entryID } -// validateProxyURL calls url.Parse with the proxy.proxy_url, if there is an error, it's added to startupWarnings +// validateProxyURL calls url.Parse with the proxy.url, if there is an error, it's added to startupWarnings func (web *Web) validateProxyURL() { - if viper.IsSet("proxy.proxy_url") { - _, err := url.Parse(viper.GetString("proxy.proxy_url")) + if viper.IsSet("proxy.url") { + _, err := url.Parse(viper.GetString("proxy.url")) if err != nil { web.startupWarning("Could not parse proxy url, check config") return