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

@@ -61,16 +61,23 @@ func (r *Reader) readOpenVPNProtocol() (tcp *bool, err error) {
}
func (r *Reader) readOpenVPNCustomPort() (customPort *uint16, err error) {
key := "OPENVPN_PORT"
s := os.Getenv(key)
const currentKey = "VPN_ENDPOINT_PORT"
key := "PORT"
s := os.Getenv(key) // Retro-compatibility
if s == "" {
// Retro-compatibility
key = "PORT"
key = "OPENVPN_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("PORT", "OPENVPN_PORT")
}
if key != currentKey {
r.onRetroActive(key, currentKey)
}
customPort = new(uint16)