 d5262ea5df
			
		
	
	
		d5262ea5df
		
	
	
	
	
		
			
			First implementation of TOFS for: nginx_config, passenger_config, servers_config and snippets Introduced tplroot on modified files as well Fixed GH link of nginx.conf file in docs/TOFS_pattern.rst Fixed test for snippets name pillar
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Nginx Configuration File
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			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() %}
 | |
|         {%- if k != 'include' %}
 | |
| {{ nginx_block(v, k, operator, delim, (ind + indent_increment)) }}
 | |
|         {%- endif %}
 | |
|         {%- endfor %}
 | |
|         {%- if 'include' in value.keys() %}
 | |
| {{ nginx_block(value['include'], 'include', operator, delim, (ind + indent_increment)) }}
 | |
|         {%- endif %}
 | |
| {{ '}'|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.
 | |
| 
 | |
| {% if 'load_module' in config.keys() %}
 | |
| {{ nginx_block(config.pop('load_module'), 'load_module') }}
 | |
| {%- endif -%}
 | |
| 
 | |
| {% if 'include' in config.keys() %}
 | |
| {{ nginx_block(config.pop('include'), 'include') }}
 | |
| {%- endif -%}
 | |
| 
 | |
| {% for key, value in config.items() %}
 | |
| {{ nginx_block(value, key) }}
 | |
| {%- endfor -%}
 |