Cleanup whitespace in generated vhosts
Correct handling of allow encoded slashes
This commit is contained in:
parent
308e05f72f
commit
f8d90931f8
@ -1,8 +1,8 @@
|
|||||||
{# Define default values here so the template below can just focus on layout #}
|
{# Define default values here so the template below can just focus on layout #}
|
||||||
{% from "apache/map.jinja" import apache with context %}
|
{%- from "apache/map.jinja" import apache with context -%}
|
||||||
{% set sitename = site.get('ServerName', id) %}
|
{%- set sitename = site.get('ServerName', id) -%}
|
||||||
|
|
||||||
{% set vals = {
|
{%- set vals = {
|
||||||
'interfaces': site.get('interface', '*').split(),
|
'interfaces': site.get('interface', '*').split(),
|
||||||
'port': site.get('port', '80'),
|
'port': site.get('port', '80'),
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
'DirectoryIndex': site.get('DirectoryIndex'),
|
'DirectoryIndex': site.get('DirectoryIndex'),
|
||||||
'UseCanonicalName': site.get('UseCanonicalName'),
|
'UseCanonicalName': site.get('UseCanonicalName'),
|
||||||
'AllowEncodedSlashes': site.get('AllowEncodedSlashes'),
|
'AllowEncodedSlashes': site.get('AllowEncodedSlashes', 'Off'),
|
||||||
|
|
||||||
'LogLevel': site.get('LogLevel', 'warn'),
|
'LogLevel': site.get('LogLevel', 'warn'),
|
||||||
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
|
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
|
||||||
@ -36,46 +36,46 @@
|
|||||||
'Allow': 'from all',
|
'Allow': 'from all',
|
||||||
'Require': 'all granted',
|
'Require': 'all granted',
|
||||||
},
|
},
|
||||||
} %}
|
} -%}
|
||||||
|
|
||||||
{% for intf in vals.interfaces -%}
|
{% for intf in vals.interfaces -%}
|
||||||
Listen {{ intf }}:{{ vals.port }}
|
Listen {{ intf }}:{{ vals.port }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
|
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
|
||||||
ServerName {{ vals.ServerName }}
|
ServerName {{ vals.ServerName }}
|
||||||
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
|
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %}
|
||||||
|
|
||||||
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %}
|
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif -%}
|
||||||
|
|
||||||
{% if site.get('DirectoryIndex') %}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %}
|
{% if site.get('DirectoryIndex') -%}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %}
|
||||||
{% if site.get('UseCanonicalName') %}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
|
{% if site.get('UseCanonicalName') -%}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
|
||||||
{% if site.get('AllowEncodedSlashes') != False %}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %}
|
{% if site.get('AllowEncodedSlashes') != False -%}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %}
|
||||||
|
|
||||||
{% if site.get('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %}
|
{% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
|
||||||
{% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %}
|
{% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
|
||||||
{% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
|
{% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
|
||||||
|
|
||||||
{% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
|
{% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
|
||||||
{% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}
|
{% if site.get('VirtualDocumentRoot') -%}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}
|
||||||
|
|
||||||
{% if site.get('SSLCertificateFile') %}
|
{%- if site.get('SSLCertificateFile') %}
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile {{ site.SSLCertificateFile }}
|
SSLCertificateFile {{ site.SSLCertificateFile }}
|
||||||
{% if site.get('SSLCertificateKeyFile') %}
|
{%- if site.get('SSLCertificateKeyFile') %}
|
||||||
SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }}
|
SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if site.get('SSLCertificateChainFile') %}
|
{%- if site.get('SSLCertificateChainFile') %}
|
||||||
SSLCertificateChainFile {{ site.SSLCertificateChainFile}}
|
SSLCertificateChainFile {{ site.SSLCertificateChainFile}}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% for loc, path in site.get('Alias', {}).items() %}
|
{%- for loc, path in site.get('Alias', {}).items() %}
|
||||||
Alias {{ loc }} {{ path }}
|
Alias {{ loc }} {{ path }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{% for path, dir in site.get('Directory', {}).items() %}
|
{%- for path, dir in site.get('Directory', {}).items() -%}
|
||||||
{% set dvals = {
|
{%- set dvals = {
|
||||||
'Options': dir.get('Options', vals.Directory.Options),
|
'Options': dir.get('Options', vals.Directory.Options),
|
||||||
'Order': dir.get('Order', vals.Directory.Order),
|
'Order': dir.get('Order', vals.Directory.Order),
|
||||||
'Allow': dir.get('Allow', vals.Directory.Allow),
|
'Allow': dir.get('Allow', vals.Directory.Allow),
|
||||||
@ -84,7 +84,7 @@ Listen {{ intf }}:{{ vals.port }}
|
|||||||
'Dav': dir.get('Dav', False),
|
'Dav': dir.get('Dav', False),
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% if path == 'default' %}{% set path = vals.Directory_default %}{% endif %}
|
{%- if path == 'default' %}{% set path = vals.Directory_default %}{% endif %}
|
||||||
|
|
||||||
<Directory "{{ path }}">
|
<Directory "{{ path }}">
|
||||||
{% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
|
{% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
|
||||||
@ -101,10 +101,10 @@ Listen {{ intf }}:{{ vals.port }}
|
|||||||
{{ dir.Formula_Append|indent(8) }}
|
{{ dir.Formula_Append|indent(8) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</Directory>
|
</Directory>
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{% for path, loc in site.get('Location', {}).items() %}
|
{%- for path, loc in site.get('Location', {}).items() %}
|
||||||
{% set lvals = {
|
{%- set lvals = {
|
||||||
'Order': loc.get('Order', vals.Location.Order),
|
'Order': loc.get('Order', vals.Location.Order),
|
||||||
'Allow': loc.get('Allow', vals.Location.Allow),
|
'Allow': loc.get('Allow', vals.Location.Allow),
|
||||||
'Require': loc.get('Require', vals.Location.Require),
|
'Require': loc.get('Require', vals.Location.Require),
|
||||||
@ -112,21 +112,21 @@ Listen {{ intf }}:{{ vals.port }}
|
|||||||
} %}
|
} %}
|
||||||
|
|
||||||
<Location "{{ path }}">
|
<Location "{{ path }}">
|
||||||
{% if apache.use_require %}
|
{%- if apache.use_require %}
|
||||||
{% if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
|
{%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
|
{%- if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
|
||||||
{% if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %}
|
{%- if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if lvals.get('Dav') != False %}Dav On{% endif %}
|
{%- if lvals.get('Dav') != False %}Dav On{% endif %}
|
||||||
|
|
||||||
{% if loc.get('Formula_Append') %}
|
{%- if loc.get('Formula_Append') %}
|
||||||
{{ loc.Formula_Append|indent(8) }}
|
{{ loc.Formula_Append|indent(8) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</Location>
|
</Location>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if site.get('Formula_Append') %}
|
{%- if site.get('Formula_Append') %}
|
||||||
{{ site.Formula_Append|indent(4) }}
|
{{ site.Formula_Append|indent(4) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
Loading…
Reference in New Issue
Block a user