feat(vpn): VPN_ENDPOINT_PORT

- Deprecate `OPENVPN_PORT`
- Deprecate `WIREGUARD_ENDPOINT_PORT`
This commit is contained in:
Quentin McGaw
2022-01-28 00:10:23 +00:00
parent a951110461
commit ea143c0c9a
3 changed files with 26 additions and 12 deletions

View File

@@ -55,16 +55,23 @@ func (r *Reader) readWireguardEndpointIP() (endpointIP net.IP, err error) {
}
func (r *Reader) readWireguardCustomPort() (customPort *uint16, err error) {
key := "WIREGUARD_ENDPOINT_PORT"
const currentKey = "VPN_ENDPOINT_PORT"
key := "WIREGUARD_PORT" // Retro-compatibility
s := os.Getenv(key)
if s == "" {
// Retro-compatibility
key = "WIREGUARD_PORT"
key = "WIREGUARD_ENDPOINT_PORT" // Retro-compatibility
s = os.Getenv(key)
if s == "" {
return nil, nil //nolint:nilnil
key = currentKey
s = os.Getenv(key)
if s == "" {
return nil, nil //nolint:nilnil
}
}
r.onRetroActive("WIREGUARD_PORT", "WIREGUARD_ENDPOINT_PORT")
}
if key != currentKey {
r.onRetroActive(key, currentKey)
}
customPort = new(uint16)