Add default_type templating option (#299)

This commit is contained in:
Pavel Starosek 2020-08-10 18:29:27 +06:00 committed by GitHub
parent fc4640bd4a
commit 0922304b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -25,6 +25,7 @@ nginx_main_template:
worker_connections: 1024 worker_connections: 1024
http_enable: true http_enable: true
http_settings: http_settings:
default_type: application/octet-stream
access_log_format: access_log_format:
- name: main - name: main
format: |- format: |-

View File

@ -27,6 +27,7 @@
worker_connections: 1024 worker_connections: 1024
http_enable: true http_enable: true
http_settings: http_settings:
default_type: application/octet-stream
access_log_format: access_log_format:
- name: main - name: main
format: | format: |

View File

@ -60,7 +60,9 @@ events {
{% if nginx_main_template.http_enable %} {% if nginx_main_template.http_enable %}
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; {% if nginx_main_template.http_settings.default_type is defined and nginx_main_template.http_settings.default_type %}
default_type {{ nginx_main_template.http_settings.default_type }};
{% endif %}
{% for access_log in nginx_main_template.http_settings.access_log_format %} {% for access_log in nginx_main_template.http_settings.access_log_format %}
log_format {{ access_log.name }} {{ access_log.format }}; log_format {{ access_log.name }} {{ access_log.format }};