chore(sources/env): bump gosettings to v0.3.0-rc13
- Use `RetroKeys` option with env.* method calls - Use `CSV*` typed methods - Inject `handleDeprecatedKey` function
This commit is contained in:
@@ -1,21 +1,18 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gosettings/sources/env"
|
||||
)
|
||||
|
||||
func (s *Source) readWireguardSelection() (
|
||||
selection settings.WireguardSelection, err error) {
|
||||
selection.EndpointIP, err = s.readWireguardEndpointIP()
|
||||
selection.EndpointIP, err = s.env.NetipAddr("VPN_ENDPOINT_IP", env.RetroKeys("WIREGUARD_ENDPOINT_IP"))
|
||||
if err != nil {
|
||||
return selection, err
|
||||
}
|
||||
|
||||
selection.EndpointPort, err = s.readWireguardCustomPort()
|
||||
selection.EndpointPort, err = s.env.Uint16Ptr("VPN_ENDPOINT_PORT", env.RetroKeys("WIREGUARD_ENDPOINT_PORT"))
|
||||
if err != nil {
|
||||
return selection, err
|
||||
}
|
||||
@@ -24,22 +21,3 @@ func (s *Source) readWireguardSelection() (
|
||||
|
||||
return selection, nil
|
||||
}
|
||||
|
||||
func (s *Source) readWireguardEndpointIP() (endpointIP netip.Addr, err error) {
|
||||
key, value := s.getEnvWithRetro("VPN_ENDPOINT_IP", []string{"WIREGUARD_ENDPOINT_IP"})
|
||||
if value == nil {
|
||||
return endpointIP, nil
|
||||
}
|
||||
|
||||
endpointIP, err = netip.ParseAddr(*value)
|
||||
if err != nil {
|
||||
return endpointIP, fmt.Errorf("environment variable %s: %w", key, err)
|
||||
}
|
||||
|
||||
return endpointIP, nil
|
||||
}
|
||||
|
||||
func (s *Source) readWireguardCustomPort() (customPort *uint16, err error) {
|
||||
envKey, _ := s.getEnvWithRetro("VPN_ENDPOINT_PORT", []string{"WIREGUARD_ENDPOINT_PORT"})
|
||||
return s.env.Uint16Ptr(envKey)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user