chore(constants): internal/constants/providers

- New package to avoid package import cycles
This commit is contained in:
Quentin McGaw
2022-04-16 19:30:26 +00:00
parent ad80e0c1ab
commit 54b7e23974
51 changed files with 335 additions and 339 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/qdm12/gluetun/internal/configuration/settings"
"github.com/qdm12/gluetun/internal/constants"
"github.com/qdm12/gluetun/internal/constants/providers"
)
func (r *Reader) readProvider(vpnType string) (provider settings.Provider, err error) {
@@ -35,11 +36,11 @@ func (r *Reader) readVPNServiceProvider(vpnType string) (vpnProviderPtr *string)
switch {
case vpnType != constants.Wireguard &&
os.Getenv("OPENVPN_CUSTOM_CONFIG") != "": // retro compatibility
return stringPtr(constants.Custom)
return stringPtr(providers.Custom)
case s == "":
return nil
case s == "pia": // retro compatibility
return stringPtr(constants.PrivateInternetAccess)
return stringPtr(providers.PrivateInternetAccess)
}
return stringPtr(s)
}