Make some variables optional. (#156)

* make variable nginx_main_template.http_global_autoindex optional

* make location variables autoindex, html_file_location and html_file_name optional
This commit is contained in:
Andrew N Golovkov 2019-07-15 20:12:44 +03:00 committed by Alessandro Fael Garcia
parent 421882389d
commit b1ee7e7ff2
2 changed files with 6 additions and 2 deletions

View File

@ -271,9 +271,13 @@ server {
{% if item.value.web_server is defined %}
{% for location in item.value.web_server.locations %}
location {{ item.value.web_server.locations[location].location }} {
{% if item.value.web_server.locations[location].html_file_location is defined %}
root {{ item.value.web_server.locations[location].html_file_location }};
{% endif %}
{% if item.value.web_server.locations[location].html_file_name is defined %}
index {{ item.value.web_server.locations[location].html_file_name }};
{% if item.value.web_server.locations[location].autoindex %}
{% endif %}
{% if item.value.web_server.locations[location].autoindex | default(false) %}
autoindex on;
{% endif %}
{% if item.value.web_server.locations[location].try_files is defined %}

View File

@ -38,7 +38,7 @@ http {
keyval_zone zone={{nginx_main_template.http_settings.keyval.zone}}:32k state=one.keyval;
keyval $arg_text $text zone=one;
{% endif %}
{% if nginx_main_template.http_global_autoindex %}
{% if nginx_main_template.http_global_autoindex | default(false) %}
autoindex on;
{% endif %}
include /etc/nginx/conf.d/*.conf;