2014-05-16 00:06:48 +02:00
|
|
|
{% set indent_increment = 4 %}
|
|
|
|
|
|
|
|
{%- macro nginx_block(value, key=None, operator=' ', delim=';', ind=0) -%}
|
2015-02-11 23:03:10 +01:00
|
|
|
{%- if value != None -%}
|
2014-05-16 00:06:48 +02:00
|
|
|
{%- if value is number or value is string -%}
|
|
|
|
{{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}
|
|
|
|
{%- elif value is mapping -%}
|
|
|
|
{{ key|indent(ind, True) }}{{ operator }}{{ '{' }}
|
|
|
|
{%- for k, v in value.items() %}
|
2015-08-15 13:31:11 +02:00
|
|
|
{%- if k != 'include' %}
|
2014-05-16 00:06:48 +02:00
|
|
|
{{ nginx_block(v, k, operator, delim, (ind + indent_increment)) }}
|
2015-08-15 13:31:11 +02:00
|
|
|
{%- endif %}
|
2014-05-16 00:06:48 +02:00
|
|
|
{%- endfor %}
|
2015-08-15 13:31:11 +02:00
|
|
|
{%- if 'include' in value.keys() %}
|
|
|
|
{{ nginx_block(value['include'], 'include', operator, delim, (ind + indent_increment)) }}
|
|
|
|
{%- endif %}
|
2014-05-16 00:06:48 +02:00
|
|
|
{{ '}'|indent(ind, True) }}
|
|
|
|
{%- elif value is iterable -%}
|
|
|
|
{%- for v in value %}
|
|
|
|
{{ nginx_block(v, key, operator, delim, ind) }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{%- else -%}
|
|
|
|
{{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}
|
|
|
|
{%- endif -%}
|
2015-02-11 23:03:10 +01:00
|
|
|
{%- else -%}
|
|
|
|
{%- endif -%}
|
2014-05-16 00:06:48 +02:00
|
|
|
{%- endmacro -%}
|
|
|
|
|
|
|
|
# Default nginx server configuration
|
|
|
|
#
|
|
|
|
# **** DO NOT EDIT THIS FILE ****
|
|
|
|
#
|
|
|
|
# This file is managed by Salt.
|
|
|
|
|
|
|
|
{% for key, value in config.items() %}
|
|
|
|
{{ nginx_block(value, key) }}
|
|
|
|
{%- endfor -%}
|