hotfix(httpproxy): Retro-compat with old env vars

This commit is contained in:
Quentin McGaw
2022-01-12 14:40:19 +00:00
parent 6f5a78c22b
commit 4bdce76041

View File

@@ -79,33 +79,17 @@ func (r *Reader) readHTTProxyPassword() (user *string) {
} }
func (r *Reader) readHTTProxyListeningAddress() (listeningAddress string) { func (r *Reader) readHTTProxyListeningAddress() (listeningAddress string) {
s := os.Getenv("HTTPPROXY_LISTENING_ADDRESS")
if s != "" {
return s
}
// Retro-compatibility // Retro-compatibility
s = os.Getenv("HTTPROXY_PORT") retroKeys := []string{"PROXY_PORT", "TINYPROXY_PORT", "HTTPPROXY_PORT"}
for _, retroKey := range retroKeys {
s := os.Getenv(retroKey)
if s != "" { if s != "" {
r.onRetroActive("HTTPROXY_PORT", "HTTPPROXY_LISTENING_ADDRESS") r.onRetroActive(retroKey, "HTTPPROXY_LISTENING_ADDRESS")
return ":" + s return ":" + s
} }
// Retro-compatibility
s = os.Getenv("TINYPROXY_PORT")
if s != "" {
r.onRetroActive("TINYPROXY_PORT", "HTTPPROXY_LISTENING_ADDRESS")
return ":" + s
} }
// Retro-compatibility return os.Getenv("HTTPPROXY_LISTENING_ADDRESS")
s = os.Getenv("PROXY_PORT")
if s != "" {
r.onRetroActive("PROXY_PORT", "HTTPPROXY_LISTENING_ADDRESS")
return ":" + s
}
return ""
} }
func (r *Reader) readHTTProxyEnabled() (enabled *bool, err error) { func (r *Reader) readHTTProxyEnabled() (enabled *bool, err error) {