Переглянути джерело

Merge pull request #111 from mchugh19/master

Cleanup whitespace in generated vhosts
master
Forrest 9 роки тому
джерело
коміт
c5987510b7
1 змінених файлів з 36 додано та 36 видалено
  1. +36
    -36
      apache/vhosts/standard.tmpl

+ 36
- 36
apache/vhosts/standard.tmpl Переглянути файл

@@ -1,8 +1,8 @@
{# Define default values here so the template below can just focus on layout #}
{% from "apache/map.jinja" import apache with context %}
{% set sitename = site.get('ServerName', id) %}
{%- from "apache/map.jinja" import apache with context -%}
{%- set sitename = site.get('ServerName', id) -%}

{% set vals = {
{%- set vals = {
'interfaces': site.get('interface', '*').split(),
'port': site.get('port', '80'),

@@ -13,7 +13,7 @@

'DirectoryIndex': site.get('DirectoryIndex'),
'UseCanonicalName': site.get('UseCanonicalName'),
'AllowEncodedSlashes': site.get('AllowEncodedSlashes'),
'AllowEncodedSlashes': site.get('AllowEncodedSlashes', 'Off'),

'LogLevel': site.get('LogLevel', 'warn'),
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)),
@@ -36,46 +36,46 @@
'Allow': 'from all',
'Require': 'all granted',
},
} %}
} -%}

{% for intf in vals.interfaces -%}
Listen {{ intf }}:{{ vals.port }}
{% endfor %}

<VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}>
ServerName {{ vals.ServerName }}
{% 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('UseCanonicalName') %}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
{% if site.get('AllowEncodedSlashes') != False %}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %}
{% if site.get('DirectoryIndex') -%}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %}
{% if site.get('UseCanonicalName') -%}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %}
{% if site.get('AllowEncodedSlashes') != False -%}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %}

{% if site.get('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %}
{% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %}
{% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}
{% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %}
{% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %}
{% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %}

{% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
{% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}
{% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %}
{% if site.get('VirtualDocumentRoot') -%}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %}

{% if site.get('SSLCertificateFile') %}
{%- if site.get('SSLCertificateFile') %}
SSLEngine on
SSLCertificateFile {{ site.SSLCertificateFile }}
{% if site.get('SSLCertificateKeyFile') %}
{%- if site.get('SSLCertificateKeyFile') %}
SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }}
{% endif %}
{% if site.get('SSLCertificateChainFile') %}
{%- endif %}
{%- if site.get('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 }}
{% endfor %}
{%- endfor %}

{% for path, dir in site.get('Directory', {}).items() %}
{% set dvals = {
{%- for path, dir in site.get('Directory', {}).items() -%}
{%- set dvals = {
'Options': dir.get('Options', vals.Directory.Options),
'Order': dir.get('Order', vals.Directory.Order),
'Allow': dir.get('Allow', vals.Directory.Allow),
@@ -84,7 +84,7 @@ Listen {{ intf }}:{{ vals.port }}
'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 }}">
{% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %}
@@ -101,10 +101,10 @@ Listen {{ intf }}:{{ vals.port }}
{{ dir.Formula_Append|indent(8) }}
{% endif %}
</Directory>
{% endfor %}
{%- endfor %}

{% for path, loc in site.get('Location', {}).items() %}
{% set lvals = {
{%- for path, loc in site.get('Location', {}).items() %}
{%- set lvals = {
'Order': loc.get('Order', vals.Location.Order),
'Allow': loc.get('Allow', vals.Location.Allow),
'Require': loc.get('Require', vals.Location.Require),
@@ -112,21 +112,21 @@ Listen {{ intf }}:{{ vals.port }}
} %}

<Location "{{ path }}">
{% if apache.use_require %}
{% if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
{%- if apache.use_require %}
{%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %}
{% else %}
{% if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
{% if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %}
{%- if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %}
{%- if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% 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) }}
{% endif %}
</Location>
{% endfor %}

{% if site.get('Formula_Append') %}
{%- if site.get('Formula_Append') %}
{{ site.Formula_Append|indent(4) }}
{% endif %}
</VirtualHost>

Завантаження…
Відмінити
Зберегти