Commit a323ccb6 authored by Sophie Herold's avatar Sophie Herold 🌼

Adjust apache2 filter for ACME

parent 9f7db8ca
Pipeline #1855 failed with stages
......@@ -442,31 +442,33 @@ class to_gshadow_line(base.Filter):
return 'to_gshadow_line()'
class to_apache2_vhost(base.Filter):
"""Converts a dictionary containing the keys 'address4'
or 'address6' into a apache2 config vhost. More options
listed in config_keys can be given in the dict."""
template_vhost = """
<VirtualHost *:{port}>
Use GenconfigVhostDefaults "{user}" "{domain}" "{port}" "{aliases}"
template_vhost_ssl = """
MDomain "{domain}"
<VirtualHost *:{port}>
Use GenconfigVhostDefaults "{user}" "{domain}" "{port}" "{aliases}"
SSLEngine On
template_ssl = ' Use GenconfigVhostSsl "{domain}" "{port}" "{https}"\n'
template_redirect = ' Redirect permanent / {option[redirect_url]}\n'
def __next__(self):
chunk = self._chunk
chunk['addons'] = ''
if chunk['https'] is not None:
chunk['addons'] += self.template_ssl.format(**chunk)
res = ""
if chunk['subservice'] == 'http_redirect':
chunk['addons'] += self.template_redirect.format(**chunk)
if chunk['https']:
res += self.template_vhost_ssl.format(**chunk)
if chunk['port'] == 443:
res += self.template_vhost.format(**{**chunk, 'port': 80})
res += self.template_vhost.format(**chunk)
return self.template_vhost.format(**chunk)
return res
def __str__(self):
return 'to_apache2_vhost()'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment