From 1693c4ed8a95296fc86b66bfe6fe1f9c1c46d102 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Sat, 5 Feb 2022 23:02:29 +0000 Subject: [PATCH] chore(env): `PRIVATE_INTERNET_ACCESS_VPN_PORT_FORWARDING` - With retro-compatibility with `PORT_FORWARDING` --- Dockerfile | 2 +- internal/configuration/sources/env/portforward.go | 9 ++++++--- internal/configuration/sources/env/provider.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8e4faec3..45b06307 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,7 +101,7 @@ ENV VPN_SERVICE_PROVIDER=pia \ OWNED_ONLY=no \ # # Private Internet Access only: PRIVATE_INTERNET_ACCESS_OPENVPN_ENCRYPTION_PRESET= \ - PORT_FORWARDING=off \ + PRIVATE_INTERNET_ACCESS_VPN_PORT_FORWARDING=off \ PORT_FORWARDING_STATUS_FILE="/tmp/gluetun/forwarded_port" \ # # Cyberghost only: OPENVPN_CLIENTCRT_SECRETFILE=/run/secrets/openvpn_clientcrt \ diff --git a/internal/configuration/sources/env/portforward.go b/internal/configuration/sources/env/portforward.go index 36c9fece..9e51deb7 100644 --- a/internal/configuration/sources/env/portforward.go +++ b/internal/configuration/sources/env/portforward.go @@ -6,11 +6,14 @@ import ( "github.com/qdm12/gluetun/internal/configuration/settings" ) -func readPortForward() ( +func (r *Reader) readPortForward() ( portForwarding settings.PortForwarding, err error) { - portForwarding.Enabled, err = envToBoolPtr("PORT_FORWARDING") + key, _ := r.getEnvWithRetro( + "PRIVATE_INTERNET_ACCESS_VPN_PORT_FORWARDING", + "PORT_FORWARDING") + portForwarding.Enabled, err = envToBoolPtr(key) if err != nil { - return portForwarding, fmt.Errorf("environment variable PORT_FORWARDING: %w", err) + return portForwarding, fmt.Errorf("environment variable %s: %w", key, err) } portForwarding.Filepath = envToStringPtr("PORT_FORWARDING_STATUS_FILE") diff --git a/internal/configuration/sources/env/provider.go b/internal/configuration/sources/env/provider.go index 4ee1b3b9..fc83950f 100644 --- a/internal/configuration/sources/env/provider.go +++ b/internal/configuration/sources/env/provider.go @@ -21,7 +21,7 @@ func (r *Reader) readProvider(vpnType string) (provider settings.Provider, err e return provider, fmt.Errorf("cannot read server selection settings: %w", err) } - provider.PortForwarding, err = readPortForward() + provider.PortForwarding, err = r.readPortForward() if err != nil { return provider, fmt.Errorf("cannot read port forwarding settings: %w", err) }