Skip to content

Commit 0922304

Browse files
authored
Add default_type templating option (#299)
1 parent fc4640b commit 0922304

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

defaults/main/template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ nginx_main_template:
2525
worker_connections: 1024
2626
http_enable: true
2727
http_settings:
28+
default_type: application/octet-stream
2829
access_log_format:
2930
- name: main
3031
format: |-

molecule/common/playbooks/template_converge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
worker_connections: 1024
2828
http_enable: true
2929
http_settings:
30+
default_type: application/octet-stream
3031
access_log_format:
3132
- name: main
3233
format: |

templates/nginx.conf.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ events {
6060
{% if nginx_main_template.http_enable %}
6161
http {
6262
include /etc/nginx/mime.types;
63-
default_type application/octet-stream;
63+
{% if nginx_main_template.http_settings.default_type is defined and nginx_main_template.http_settings.default_type %}
64+
default_type {{ nginx_main_template.http_settings.default_type }};
65+
{% endif %}
6466

6567
{% for access_log in nginx_main_template.http_settings.access_log_format %}
6668
log_format {{ access_log.name }} {{ access_log.format }};

0 commit comments

Comments
 (0)