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
}
countriesCSV := os.Getenv("COUNTRY")
if vpnProvider == constants.Cyberghost && countriesCSV == "" {
// Retro-compatibility
countriesCSV = os.Getenv("REGION")
if countriesCSV != "" {
ss.Countries = envToCSV("COUNTRY")
if vpnProvider == constants.Cyberghost && len(ss.Countries) == 0 {
// Retro-compatibility for Cyberghost using the REGION variable
ss.Countries = envToCSV("REGION")
if len(ss.Countries) > 0 {
r.onRetroActive("REGION", "COUNTRY")
}
}
if countriesCSV != "" {
ss.Countries = lowerAndSplit(countriesCSV)
}
ss.Regions = envToCSV("REGION")
ss.Cities = envToCSV("CITY")