nginx-formula/nginx/ng/files/nginx.conf
Niels Abspoel 4a976bf1ab added test for value None, to be an absent value
this is needed on archlinux where the pid file is set by systemd
not the nginx.conf file.

In the pillar file you just add
  pid:

an value of 'None' and no pid entry in nginx.conf.
this now works with every None value set in the pillar file
2015-02-11 23:03:10 +01:00

33 lines
997 B
Nginx Configuration File

{% set indent_increment = 4 %}
{%- macro nginx_block(value, key=None, operator=' ', delim=';', ind=0) -%}
{%- if value != None -%}
{%- 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() %}
{{ nginx_block(v, k, operator, delim, (ind + indent_increment)) }}
{%- endfor %}
{{ '}'|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 -%}
{%- else -%}
{%- endif -%}
{%- 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 -%}