hotfix(env): fix parsing of unset server filters

This commit is contained in:
Quentin McGaw
2022-02-06 20:13:40 +00:00
parent ed6c010aff
commit 2a19b68b9a

View File

@@ -25,8 +25,8 @@ func (r *Reader) readServerSelection(vpnProvider, vpnType string) (
return ss, err return ss, err
} }
_, countriesCSV := r.getEnvWithRetro("SERVER_COUNTRIES", "COUNTRY") countriesKey, _ := r.getEnvWithRetro("SERVER_COUNTRIES", "COUNTRY")
ss.Countries = lowerAndSplit(countriesCSV) ss.Countries = envToCSV(countriesKey)
if vpnProvider == constants.Cyberghost && len(ss.Countries) == 0 { if vpnProvider == constants.Cyberghost && len(ss.Countries) == 0 {
// Retro-compatibility for Cyberghost using the REGION variable // Retro-compatibility for Cyberghost using the REGION variable
ss.Countries = envToCSV("REGION") ss.Countries = envToCSV("REGION")
@@ -35,19 +35,19 @@ func (r *Reader) readServerSelection(vpnProvider, vpnType string) (
} }
} }
_, regionsCSV := r.getEnvWithRetro("SERVER_REGIONS", "REGION") regionsKey, _ := r.getEnvWithRetro("SERVER_REGIONS", "REGION")
ss.Regions = lowerAndSplit(regionsCSV) ss.Regions = envToCSV(regionsKey)
_, citiesCSV := r.getEnvWithRetro("SERVER_CITIES", "CITY") citiesKey, _ := r.getEnvWithRetro("SERVER_CITIES", "CITY")
ss.Cities = lowerAndSplit(citiesCSV) ss.Cities = envToCSV(citiesKey)
ss.ISPs = envToCSV("ISP") ss.ISPs = envToCSV("ISP")
_, hostnamesCSV := r.getEnvWithRetro("SERVER_HOSTNAMES", "SERVER_HOSTNAME") hostnamesKey, _ := r.getEnvWithRetro("SERVER_HOSTNAMES", "SERVER_HOSTNAME")
ss.Hostnames = lowerAndSplit(hostnamesCSV) ss.Hostnames = envToCSV(hostnamesKey)
_, namesCSV := r.getEnvWithRetro("SERVER_NAMES", "SERVER_NAME") serverNamesKey, _ := r.getEnvWithRetro("SERVER_NAMES", "SERVER_NAME")
ss.Names = lowerAndSplit(namesCSV) ss.Names = envToCSV(serverNamesKey)
if csv := os.Getenv("SERVER_NUMBER"); csv != "" { if csv := os.Getenv("SERVER_NUMBER"); csv != "" {
numbersStrings := strings.Split(csv, ",") numbersStrings := strings.Split(csv, ",")