Support for configuration of basic authentication (#99)

* Support for basic authentication
This commit is contained in:
Marcin Mielnicki 2019-02-12 13:32:11 +01:00 committed by Grzegorz Dzien
parent 8db44bf979
commit 80f6157692
3 changed files with 20 additions and 0 deletions

View File

@ -344,6 +344,8 @@ nginx_http_template:
html_file_location: /usr/share/nginx/html
html_file_name: index.html
autoindex: false
auth_basic: null
auth_basic_file: null
http_demo_conf: false
reverse_proxy:
locations:
@ -351,6 +353,8 @@ nginx_http_template:
location: /
proxy_pass: http://backend
websocket: false
auth_basic: null
auth_basic_file: null
health_check_plus: false
upstreams:
upstream1:

View File

@ -175,6 +175,8 @@ nginx_http_template:
html_file_location: /usr/share/nginx/html
html_file_name: index.html
autoindex: false
auth_basic: null
auth_basic_file: null
http_demo_conf: false
reverse_proxy:
locations:
@ -182,6 +184,8 @@ nginx_http_template:
location: /
proxy_pass: http://backend
websocket: false
auth_basic: null
auth_basic_file: null
health_check_plus: false
upstreams:
upstream1:

View File

@ -33,6 +33,12 @@ server {
{% if item.value.reverse_proxy is defined %}
{% for location in item.value.reverse_proxy.locations %}
location {{ item.value.reverse_proxy.locations[location].location }} {
{% if item.value.reverse_proxy.locations[location].auth_basic is defined and item.value.reverse_proxy.locations[location].auth_basic %}
auth_basic "{{ item.value.reverse_proxy.locations[location].auth_basic }}";
{% endif %}
{% if item.value.reverse_proxy.locations[location].auth_basic_file is defined and item.value.reverse_proxy.locations[location].auth_basic_file %}
auth_basic_user_file {{ item.value.reverse_proxy.locations[location].auth_basic_file }};
{% endif %}
proxy_pass {{ item.value.reverse_proxy.locations[location].proxy_pass }};
{% if item.value.reverse_proxy.health_check_plus is defined and item.value.reverse_proxy.health_check_plus %}
health_check;
@ -56,6 +62,12 @@ server {
index {{ item.value.web_server.locations[location].html_file_name }};
{% if item.value.web_server.locations[location].autoindex %}
autoindex on;
{% endif %}
{% if item.value.web_server.locations[location].auth_basic is defined and item.value.web_server.locations[location].auth_basic %}
auth_basic "{{ item.value.web_server.locations[location].auth_basic }}";
{% endif %}
{% if item.value.web_server.locations[location].auth_basic_file is defined and item.value.web_server.locations[location].auth_basic_file %}
auth_basic_user_file {{ item.value.web_server.locations[location].auth_basic_file }};
{% endif %}
}
{% endfor %}