فهرست منبع

Merge pull request #56 from geerlingguy/revert-53-feature/whitespace-control

Revert "prevent whitespace from jinja control structures from making it into templates"
Jeff Geerling 9 سال پیش
والد
کامیت
82575ce142
2فایلهای تغییر یافته به همراه16 افزوده شده و 23 حذف شده
  1. 8 9
      templates/nginx.conf.j2
  2. 8 14
      templates/vhosts.j2

+ 8 - 9
templates/nginx.conf.j2

@@ -10,9 +10,9 @@ events {
     multi_accept {{ nginx_multi_accept }};
 }
 
-{% if nginx_extra_conf_options -%}
+{% if nginx_extra_conf_options %}
 {{ nginx_extra_conf_options }}
-{%- endif %}
+{% endif %}
 
 http {
     include       {{ nginx_mime_file_path }};
@@ -37,28 +37,27 @@ http {
 
     #gzip  on;
 
-{%- if nginx_proxy_cache_path -%}
+{% if nginx_proxy_cache_path %}
     proxy_cache_path {{ nginx_proxy_cache_path }};
 {% endif %}
 
-{%- if nginx_extra_http_options -%}
+{% if nginx_extra_http_options %}
     {{ nginx_extra_http_options }}
 {% endif %}
 
-{%- for upstream in nginx_upstreams -%}
+{% for upstream in nginx_upstreams %}
     upstream {{ upstream.name }} {
-{%- if upstream.strategy is defined -%}
+{% if upstream.strategy is defined %}
         {{ upstream.strategy }};
 {% endif %}
-{%- for server in upstream.servers -%}
+{% for server in upstream.servers %}
         server {{ server }};
 {% endfor %}
     }
 {% endfor %}
 
     include {{ nginx_conf_path }}/*.conf;
-{%- if nginx_conf_path != nginx_vhost_path -%}
+{% if nginx_conf_path != nginx_vhost_path %}
     include {{ nginx_vhost_path }}/*;
 {% endif %}
-
 }

+ 8 - 14
templates/vhosts.j2

@@ -1,39 +1,33 @@
-{% for vhost in nginx_vhosts -%}
+{% for vhost in nginx_vhosts %}
 server {
-
     listen {{ vhost.listen | default('80 default_server') }};
 
     {% if vhost.server_name is defined %}
     server_name {{ vhost.server_name }};
     {% endif %}
 
-    {%- if vhost.root is defined -%}
+    {% if vhost.root is defined %}
     root {{ vhost.root }};
     {% endif %}
 
-    {%- if vhost.index is defined -%}
-    index {{ vhost.index }};
-    {% endif %}
+    index {{ vhost.index | default('index.html index.htm') }};
 
-    {%- if vhost.error_page is defined -%}
+    {% if vhost.error_page is defined %}
     error_page {{ vhost.error_page }};
     {% endif %}
-
-    {%- if vhost.access_log is defined -%}
+    {% if vhost.access_log is defined %}
     access_log {{ vhost.access_log }};
     {% endif %}
-
-    {%- if vhost.error_log is defined -%}
+    {% if vhost.error_log is defined %}
     error_log {{ vhost.error_log }} error;
     {% endif %}
 
-    {%- if vhost.return is defined -%}
+    {% if vhost.return is defined %}
     return {{ vhost.return }};
     {% endif %}
 
-    {%- if vhost.extra_parameters is defined -%}
+    {% if vhost.extra_parameters is defined %}
     {{ vhost.extra_parameters }}
     {% endif %}
-
 }
 {% endfor %}