Manage auth basic on all vhost

This commit is contained in:
Emilien Mantel
2015-12-03 17:09:29 +01:00
parent 88d1c7fdb7
commit f9127f9a40
2 changed files with 16 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
{% set __listen = item.listen | default(['80']) %}
{% set __listen_ssl = item.listen_ssl | default(['443']) %}
{% set __location = item.location | default({}) %}
{% macro htpasswd(htpasswd_name, indent=2) -%}
{% macro htpasswd(htpasswd_name, indent=1) -%}
{% for ht in nginx_htpasswd %}{% if ht.name == htpasswd_name %}
{{ "\t" * indent }}auth_basic "{{ ht.description }}";
{{ "\t" * indent }}auth_basic_user_file {{ nginx_htpasswd_dir }}/{{ ht.name }};
@@ -36,6 +36,10 @@ server {
{% endfor %}
{% endif %}
{% if item.htpasswd is defined %}
{{ htpasswd(item.htpasswd, 1) }}
{% endif %}
{% if not __location.has_key('/') %}
location / {
{% block template_try_files %}