Saltstack Official Nginx Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 'include' in config.keys() %}
  33. {{ nginx_block(config.pop('include'), 'include') }}
  34. {%- endif -%}
  35. {% for key, value in config.items() %}
  36. {{ nginx_block(value, key) }}
  37. {%- endfor -%}