hotfix(env): read some settings with case sensitivity
This commit is contained in:
16
internal/configuration/sources/env/httproxy.go
vendored
16
internal/configuration/sources/env/httproxy.go
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gosettings/sources/env"
|
||||
"github.com/qdm12/govalid/binary"
|
||||
)
|
||||
|
||||
@@ -31,7 +32,8 @@ func (s *Source) readHTTPProxy() (httpProxy settings.HTTPProxy, err error) {
|
||||
}
|
||||
|
||||
func (s *Source) readHTTProxyUser() (user *string) {
|
||||
_, value := s.getEnvWithRetro("HTTPPROXY_USER", "PROXY_USER", "TINYPROXY_USER")
|
||||
_, value := s.getEnvWithRetro("HTTPPROXY_USER",
|
||||
[]string{"PROXY_USER", "TINYPROXY_USER"}, env.ForceLowercase(false))
|
||||
if value != "" {
|
||||
return &value
|
||||
}
|
||||
@@ -39,7 +41,8 @@ func (s *Source) readHTTProxyUser() (user *string) {
|
||||
}
|
||||
|
||||
func (s *Source) readHTTProxyPassword() (user *string) {
|
||||
_, value := s.getEnvWithRetro("HTTPPROXY_PASSWORD", "PROXY_PASSWORD", "TINYPROXY_PASSWORD")
|
||||
_, value := s.getEnvWithRetro("HTTPPROXY_PASSWORD",
|
||||
[]string{"PROXY_PASSWORD", "TINYPROXY_PASSWORD"}, env.ForceLowercase(false))
|
||||
if value != "" {
|
||||
return &value
|
||||
}
|
||||
@@ -47,7 +50,8 @@ func (s *Source) readHTTProxyPassword() (user *string) {
|
||||
}
|
||||
|
||||
func (s *Source) readHTTProxyListeningAddress() (listeningAddress string) {
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY_LISTENING_ADDRESS", "PROXY_PORT", "TINYPROXY_PORT", "HTTPPROXY_PORT")
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY_LISTENING_ADDRESS",
|
||||
[]string{"PROXY_PORT", "TINYPROXY_PORT", "HTTPPROXY_PORT"})
|
||||
if key == "HTTPPROXY_LISTENING_ADDRESS" {
|
||||
return value
|
||||
}
|
||||
@@ -55,7 +59,8 @@ func (s *Source) readHTTProxyListeningAddress() (listeningAddress string) {
|
||||
}
|
||||
|
||||
func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY", "PROXY", "TINYPROXY")
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY",
|
||||
[]string{"PROXY", "TINYPROXY"})
|
||||
enabled, err = binary.Validate(value)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("environment variable %s: %w", key, err)
|
||||
@@ -65,7 +70,8 @@ func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
|
||||
}
|
||||
|
||||
func (s *Source) readHTTProxyLog() (enabled *bool, err error) {
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY_LOG", "PROXY_LOG_LEVEL", "TINYPROXY_LOG")
|
||||
key, value := s.getEnvWithRetro("HTTPPROXY_LOG",
|
||||
[]string{"PROXY_LOG_LEVEL", "TINYPROXY_LOG"})
|
||||
|
||||
var binaryOptions []binary.Option
|
||||
if key != "HTTPROXY_LOG" {
|
||||
|
||||
Reference in New Issue
Block a user