Saltstack Official Nginx Formula
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

38 lines
1.2KB

  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. {% for key, value in config.items() %}
  33. {{ nginx_block(value, key) }}
  34. {%- endfor -%}