Saltstack Official Nginx Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

46 líneas
1.4KB

  1. {% set indent_increment = 4 %}
  2. {%- macro nginx_block(value, key=None, operator=' ', delim=';', ind=0) -%}
  3. {%- if value != None -%}
  4. {%- if value is number or value is string -%}
  5. {{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}
  6. {%- elif value is mapping -%}
  7. {{ key|indent(ind, True) }}{{ operator }}{{ '{' }}
  8. {%- for k, v in value.items() %}
  9. {%- if k != 'include' %}
  10. {{ nginx_block(v, k, operator, delim, (ind + indent_increment)) }}
  11. {%- endif %}
  12. {%- endfor %}
  13. {%- if 'include' in value.keys() %}
  14. {{ nginx_block(value['include'], 'include', operator, delim, (ind + indent_increment)) }}
  15. {%- endif %}
  16. {{ '}'|indent(ind, True) }}
  17. {%- elif value is iterable -%}
  18. {%- for v in value %}
  19. {{ nginx_block(v, key, operator, delim, ind) }}
  20. {%- endfor -%}
  21. {%- else -%}
  22. {{ key|indent(ind, True) }}{{ operator }}{{ value }}{{ delim }}
  23. {%- endif -%}
  24. {%- else -%}
  25. {%- endif -%}
  26. {%- endmacro -%}
  27. # Default nginx server configuration
  28. #
  29. # **** DO NOT EDIT THIS FILE ****
  30. #
  31. # This file is managed by Salt.
  32. {% if 'load_module' in config.keys() %}
  33. {{ nginx_block(config.pop('load_module'), 'load_module') }}
  34. {%- endif -%}
  35. {% if 'include' in config.keys() %}
  36. {{ nginx_block(config.pop('include'), 'include') }}
  37. {%- endif -%}
  38. {% for key, value in config.items() %}
  39. {{ nginx_block(value, key) }}
  40. {%- endfor -%}