chore(deps): bump gosettings and govalid

This commit is contained in:
Quentin McGaw
2023-05-27 08:52:41 +00:00
parent a43973c093
commit 75670a80b8
11 changed files with 16 additions and 35 deletions

View File

@@ -38,12 +38,7 @@ func (s *Source) readDNSBlacklist() (blacklist settings.DNSBlacklist, err error)
func (s *Source) readBlockSurveillance() (blocked *bool, err error) {
key, value := s.getEnvWithRetro("BLOCK_SURVEILLANCE", "BLOCK_NSA")
if value == "" {
return nil, nil //nolint:nilnil
}
blocked = new(bool)
*blocked, err = binary.Validate(value)
blocked, err = binary.Validate(value)
if err != nil {
return nil, fmt.Errorf("environment variable %s: %w", key, err)
}

View File

@@ -48,14 +48,11 @@ func envToStringPtr(envKey string) (stringPtr *string) {
func envToBoolPtr(envKey string) (boolPtr *bool, err error) {
s := getCleanedEnv(envKey)
if s == "" {
return nil, nil //nolint:nilnil
}
value, err := binary.Validate(s)
if err != nil {
return nil, err
}
return &value, nil
return value, nil
}
func envToIntPtr(envKey string) (intPtr *int, err error) {

View File

@@ -56,12 +56,7 @@ func (s *Source) readHTTProxyListeningAddress() (listeningAddress string) {
func (s *Source) readHTTProxyEnabled() (enabled *bool, err error) {
key, value := s.getEnvWithRetro("HTTPPROXY", "PROXY", "TINYPROXY")
if value == "" {
return nil, nil //nolint:nilnil
}
enabled = new(bool)
*enabled, err = binary.Validate(value)
enabled, err = binary.Validate(value)
if err != nil {
return nil, fmt.Errorf("environment variable %s: %w", key, err)
}
@@ -71,9 +66,6 @@ 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")
if value == "" {
return nil, nil //nolint:nilnil
}
var binaryOptions []binary.Option
if key != "HTTPROXY_LOG" {
@@ -81,8 +73,7 @@ func (s *Source) readHTTProxyLog() (enabled *bool, err error) {
binaryOptions = append(binaryOptions, retroOption)
}
enabled = new(bool)
*enabled, err = binary.Validate(value, binaryOptions...)
enabled, err = binary.Validate(value, binaryOptions...)
if err != nil {
return nil, fmt.Errorf("environment variable %s: %w", key, err)
}

View File

@@ -119,7 +119,7 @@ func (s *Source) readOpenVPNProcessUser() (processUser string, err error) {
if err != nil {
return "", fmt.Errorf("environment variable %s: %w", key, err)
}
if root {
if *root {
return "root", nil
}
const defaultNonRootUser = "nonrootuser"

View File

@@ -20,16 +20,11 @@ func (s *Source) readControlServer() (controlServer settings.ControlServer, err
func readControlServerLog() (enabled *bool, err error) {
s := getCleanedEnv("HTTP_CONTROL_SERVER_LOG")
if s == "" {
return nil, nil //nolint:nilnil
}
log, err := binary.Validate(s)
if err != nil {
return nil, fmt.Errorf("environment variable HTTP_CONTROL_SERVER_LOG: %w", err)
}
return &log, nil
return log, nil
}
func (s *Source) readControlServerAddress() (address *string) {

View File

@@ -22,8 +22,7 @@ func readVersionEnabled() (enabled *bool, err error) {
return nil, nil //nolint:nilnil
}
enabled = new(bool)
*enabled, err = binary.Validate(s)
enabled, err = binary.Validate(s)
if err != nil {
return nil, fmt.Errorf("environment variable VERSION_INFORMATION: %w", err)
}