Support for 'include' directive in http templating (#160)

* Added 'include' directive in http templating

* Added 'include' directive in stream templating
This commit is contained in:
Zeno Grandi 2019-07-17 13:32:47 +02:00 committed by Alessandro Fael Garcia
parent 1724fecdd8
commit 42f776f7d8
4 changed files with 28 additions and 0 deletions

View File

@ -360,6 +360,7 @@ nginx_http_template:
conf_file_location: /etc/nginx/conf.d/
port: 8081
server_name: localhost
include_files: []
error_page: /usr/share/nginx/html
root: /usr/share/nginx/html
https_redirect: false
@ -399,6 +400,7 @@ nginx_http_template:
locations:
default:
location: /
include_files: []
proxy_hide_headers: [] # A list of headers which shouldn't be passed to the application
add_headers:
strict_transport_security:
@ -448,6 +450,7 @@ nginx_http_template:
locations:
backend:
location: /
include_files: []
proxy_hide_headers: [] # A list of headers which shouldn't be passed to the application
add_headers:
strict_transport_security:
@ -578,6 +581,7 @@ nginx_stream_template:
listen_address: localhost
listen_port: 80
udp_enable: false
include_files: []
proxy_pass: backend
proxy_timeout: 3s
proxy_connect_timeout: 1s

View File

@ -172,6 +172,7 @@ nginx_http_template:
conf_file_location: /etc/nginx/conf.d/
port: 8081
server_name: localhost
include_files: []
error_page: /usr/share/nginx/html
root: /usr/share/nginx/html
https_redirect: false
@ -211,6 +212,7 @@ nginx_http_template:
locations:
default:
location: /
include_files: []
proxy_hide_headers: [] # A list of headers which shouldn't be passed to the application
add_headers:
strict_transport_security:
@ -260,6 +262,7 @@ nginx_http_template:
locations:
backend:
location: /
include_files: []
proxy_hide_headers: [] # A list of headers which shouldn't be passed to the application
add_headers:
strict_transport_security:
@ -390,6 +393,7 @@ nginx_stream_template:
listen_address: localhost
listen_port: 80
udp_enable: false
include_files: []
proxy_pass: backend
proxy_timeout: 3s
proxy_connect_timeout: 1s

View File

@ -91,6 +91,11 @@ server {
listen {{ item.value.port }};
{% endif %}
server_name {{ item.value.server_name | default('localhost') }};
{% if item.value.include_files is defined and item.value.include_files | length %}
{% for file in item.value.include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
{% if item.value.proxy_hide_headers is defined %}
{% for header in item.value.proxy_hide_headers %}
proxy_hide_header {{ header }};
@ -135,6 +140,11 @@ server {
{% if item.value.reverse_proxy.locations[location].internal is sameas true %}
internal;
{% endif %}
{% if item.value.reverse_proxy.locations[location].include_files is defined and item.value.reverse_proxy.locations[location].include_files | length %}
{% for file in item.value.reverse_proxy.locations[location].include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
{% if item.value.reverse_proxy.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.reverse_proxy.locations[location].proxy_hide_headers %}
proxy_hide_header {{ header }};
@ -289,6 +299,11 @@ server {
{% if item.value.web_server.locations[location].try_files is defined %}
try_files {{ item.value.web_server.locations[location].try_files }};
{% endif %}
{% if item.value.web_server.locations[location].include_files is defined and item.value.web_server.locations[location].include_files | length %}
{% for file in item.value.web_server.locations[location].include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
{% if item.value.web_server.locations[location].proxy_hide_headers is defined %}
{% for header in item.value.web_server.locations[location].proxy_hide_headers %}
proxy_hide_header {{ header }};

View File

@ -42,6 +42,11 @@ server {
{% else %}
listen {{ item.value.network_streams[stream].listen_port }};
{% endif %}
{% endif %}
{% if item.value.network_streams[stream].include_files is defined and item.value.network_streams[stream].include_files | length %}
{% for file in item.value.network_streams[stream].include_files %}
include "{{ file }}";
{% endfor %}
{% endif %}
proxy_pass {{ item.value.network_streams[stream].proxy_pass }};
proxy_timeout {{ item.value.network_streams[stream].proxy_timeout }};