Saltstack Official Nginx Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 line
1.1KB

  1. {% set ind_increment = 4 %}
  2. {%- macro server_config(values, key='', ind=0, lb='\n', delim=';', operator=' ') -%}
  3. {%- for value in values -%}
  4. {%- if value is number or value is string -%}
  5. {{ lb }}{{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}
  6. {%- elif value is mapping -%}
  7. {%- for k, v in value.items() -%}
  8. {%- if v is number or v is string -%}
  9. {{ server_config([v], k, ind) }}
  10. {%- elif v|length() > 0 and (v[0] is number or v[0] is string) -%}
  11. {{ lb }}{{ k|indent(ind,True) }}{{ server_config(v,'', 0, '', '')}}{{ delim }}
  12. {%- else %}
  13. {{ lb }}{{ k|indent(ind, True) }} {{ '{' }}
  14. {{- server_config(v, '', ind + ind_increment) }}
  15. {{ '}'|indent(ind, True) }}
  16. {%- endif -%}
  17. {%- endfor -%}
  18. {%- elif value is iterable -%}
  19. {{ server_config(value, ind + ind_increment, delim, operator) }}
  20. {%- endif -%}
  21. {%- endfor -%}
  22. {%- endmacro -%}
  23. # Nginx server configuration
  24. #
  25. # **** DO NOT EDIT THIS FILE ****
  26. #
  27. # This file is managed by Salt.
  28. {{ server_config(config) }}