chore(constants): internal/constants/providers
- New package to avoid package import cycles
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/constants/providers"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -27,7 +27,7 @@ func (r *Reader) readServerSelection(vpnProvider, vpnType string) (
|
||||
|
||||
countriesKey, _ := r.getEnvWithRetro("SERVER_COUNTRIES", "COUNTRY")
|
||||
ss.Countries = envToCSV(countriesKey)
|
||||
if vpnProvider == constants.Cyberghost && len(ss.Countries) == 0 {
|
||||
if vpnProvider == providers.Cyberghost && len(ss.Countries) == 0 {
|
||||
// Retro-compatibility for Cyberghost using the REGION variable
|
||||
ss.Countries = envToCSV("REGION")
|
||||
if len(ss.Countries) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user