Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit abfcf83

Browse files
committed
allow ADDITIONAL_BACKEND_<NAME> contain more that 9 chars
1 parent 799a1da commit abfcf83

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

haproxy/config.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,24 @@ def parse_extra_frontend_settings(envvars):
5252
def parse_additional_backend_settings(envvars):
5353
settings_dict = {}
5454
if isinstance(envvars, os._Environ) or isinstance(envvars, dict):
55-
additional_backend_pattern = re.compile(r"^ADDITIONAL_BACKEND_(\w{1,9})$")
56-
additional_backend_file_pattern = re.compile(r"^ADDITIONAL_BACKEND_FILE_(\w{1,9})$")
55+
additional_backend_pattern = re.compile(r"^ADDITIONAL_BACKEND_(\w+)$")
56+
additional_backend_file_pattern = re.compile(r"^ADDITIONAL_BACKEND_FILE_(\w+)$")
5757
for k, v in envvars.iteritems():
5858
settings = []
5959
match = additional_backend_pattern.match(k)
6060
file_match = additional_backend_file_pattern.match(k)
61-
if match:
62-
server = match.group(1)
63-
settings.extend([x.strip().replace("\,", ",") for x in re.split(r'(?<!\\),', v.strip())])
64-
elif file_match:
61+
62+
if file_match:
6563
server = file_match.group(1)
6664
try:
67-
with open(v) as file:
68-
for line in file:
65+
with open(v) as f:
66+
for line in f:
6967
settings.append(line.strip())
7068
except Exception as e:
7169
logger.info("Error reading %s at '%s', error %s" % (k, v, e))
70+
elif match:
71+
server = match.group(1)
72+
settings.extend([x.strip().replace("\,", ",") for x in re.split(r'(?<!\\),', v.strip())])
7273

7374
if len(settings) > 0:
7475
if server in settings_dict:

0 commit comments

Comments
 (0)