nginx-formula/nginx/files/server.conf

30 lines
1.0 KiB
Plaintext
Raw Normal View History

2014-05-19 19:04:43 +02:00
{% set ind_increment = 4 %}
{%- macro server_config(values, key='', ind=0, lb='\n', delim=';', operator=' ') -%}
2014-05-19 19:04:43 +02:00
{%- for value in values -%}
{%- if value is number or value is string -%}
{{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}{{ lb }}
2014-05-19 19:04:43 +02:00
{%- elif value is mapping -%}
{%- for k, v in value.items() -%}
{%- if v is number or v is string -%}
{{ server_config([v], k, ind) }}
2014-05-19 19:04:43 +02:00
{%- elif v|length() > 0 and (v[0] is number or v[0] is string) -%}
{{ server_config(v, k, ind) }}
{%- else -%}
{{ lb }}{{ k|indent(ind, True) }} {{ '{' }}
{{ server_config(v, '', ind + ind_increment) -}}
{{ '}'|indent(ind, True) }}{{ lb }}
2014-05-19 19:04:43 +02:00
{%- endif -%}
{%- endfor -%}
{%- elif value is iterable -%}
{{ server_config(value, ind + ind_increment, delim, operator) }}
2014-05-19 19:04:43 +02:00
{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
# Nginx server configuration
2014-05-19 19:04:43 +02:00
#
# **** DO NOT EDIT THIS FILE ****
#
# This file is managed by Salt.
{{ server_config(config) }}