chore(env): simplify Cyberghost retro logic

This commit is contained in:
Quentin McGaw
2022-02-05 23:04:28 +00:00
parent 691ade794b
commit 3f5c72d898

View File

@@ -25,17 +25,14 @@ func (r *Reader) readServerSelection(vpnProvider, vpnType string) (
return ss, err return ss, err
} }
countriesCSV := os.Getenv("COUNTRY") ss.Countries = envToCSV("COUNTRY")
if vpnProvider == constants.Cyberghost && countriesCSV == "" { if vpnProvider == constants.Cyberghost && len(ss.Countries) == 0 {
// Retro-compatibility // Retro-compatibility for Cyberghost using the REGION variable
countriesCSV = os.Getenv("REGION") ss.Countries = envToCSV("REGION")
if countriesCSV != "" { if len(ss.Countries) > 0 {
r.onRetroActive("REGION", "COUNTRY") r.onRetroActive("REGION", "COUNTRY")
} }
} }
if countriesCSV != "" {
ss.Countries = lowerAndSplit(countriesCSV)
}
ss.Regions = envToCSV("REGION") ss.Regions = envToCSV("REGION")
ss.Cities = envToCSV("CITY") ss.Cities = envToCSV("CITY")