Skip to content

Commit

Permalink
Modified host regex to match alternative syntax
Browse files Browse the repository at this point in the history
The following host rule syntax is valid within traefik:

"Host(`subdomain.domain.com`,`subdomain2.domain.com`,`subdomain3.domain.com`)"

This configuration was incorrectly parsed previously, and the 'Host' portion
of regex is safe to remove based on the "if 'Host' in value:" check.
  • Loading branch information
dchidell committed Aug 22, 2020
1 parent 7264359 commit e5c6f71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion install/etc/cont-init.d/10-cloudflare-companion
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def check_container(c):
value = c.attrs.get(u'Config').get(u'Labels').get(prop)
if 'Host' in value:
print "container rule value: ", value
extracted_domains = re.findall(r'Host.*?\(\`(.*?)\`\)', value)
extracted_domains = re.findall(r'\`([a-zA-Z0-9\.]+)\`', value)
print "extracted_domains from rule: ", extracted_domains
cont_id = c.attrs.get(u'Id')
if len(extracted_domains) > 1:
Expand Down

0 comments on commit e5c6f71

Please sign in to comment.