reformat proxy env

This commit is contained in:
Roy Olav Purser 2021-07-23 17:23:57 +02:00
parent 46bc95c34f
commit a72b37bc34
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -69,7 +69,7 @@ class ProxyElem():
proxies = {}
new_providers = {}
for key in providers:
expr = re.compile(f'{key}_([a-z][a-z])?[0-9]+', re.IGNORECASE)
expr = re.compile(f'^{key}_proxy(_[a-z][a-z])?[0-9]+$', re.IGNORECASE)
matches = list(filter(expr.match, os.environ.keys()))
current = []
current_keys = set()
@ -81,7 +81,7 @@ for key in providers:
country = None
pos = len(country_groups) - 1
if pos >= 0:
country = country_groups[pos]
country = country_groups[pos].strip("_")
current_keys.add(f'{key}_{country}')
proxy = os.environ.get(match)
if proxy is not None: