{% import 'languages/'+lang|default('en')+'.html' as lang %}

{{lang.words.config|title()}} {% if config_file_name != 'undefined' %}{{config_file_name.replace('92', '/')}}{%endif%} {{lang.words.from}} {{serv}} ({{hostname}})

{% if role <= 3 %} {% if not is_serv_protected or role <= 2 %} {% if not configver %} {{lang.words.edit|title()}} {% endif %} {% if service == 'haproxy' %} {{lang.words.add|title()}} {% elif service == 'keepalived' %} {{lang.words.add|title()}} {% endif %} {% endif %} {% endif %} {{lang.words.expand_all|title()}}

{% set i = 0 -%} {% set section_name = {} %} {% for line in conf -%} {% set i = i + loop.index0 %} {% if not role %} {% if line.startswith('#HideBlockStart') %} {% continue %} {% endif %} {% endif %} {% if service == 'nginx' %} {% if i == 0 and "server {" not in line %}
{{ i }}   {{ line }}
{% continue %} {% endif %} {%- if "server {" in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "stream {" in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "http {" in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "events {" in line -%}
{{ line }}
{% continue %} {% endif %} {% if "listen " in line or "location" in line or "server_name" in line or "}" in line %} {% if "#" not in line %} {{ i }}  {{ line }}
{% continue %} {% endif %} {% endif %} {% if "#" in line %} {{ i }}  {{ line }}
{% continue %} {% endif %} {% if line|length > 1 %} {{ i }}   {{ line }}
{% endif %} {% elif service == 'apache' %} {% if i == 0 and "
{{ i }}   {{ line }}
{% continue %} {% endif %} {%- if " 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {% if "<" in line or " {{ i }}  {{ line }}
{% continue %} {% endif %} {% endif %} {% if "#" in line %} {{ i }}  {{ line }}
{% continue %} {% endif %} {% if line|length > 1 %} {{ i }}   {{ line }}
{% endif %} {% elif service == 'keepalived' %} {%- if "global_defs {" in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "vrrp_instance " in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "virtual_server " in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {%- if "vrrp_script " in line -%} {% if i > 1 %}
{% endif %} {{ line }}
{% continue %} {% endif %} {% if "state " in line or "interface" in line or "priority" in line or "}" in line %} {% if "#" not in line %} {{ i }}   {{ line }}
{% continue %} {% endif %} {% endif %} {% if "#" in line %} {{ i }}   {{ line }}
{% continue %} {% endif %} {% if line|length > 1 %} {{ i }}   {{ line }}
{% endif %} {% else %} {% if line.startswith('global') %} {{ line }} {% if role %} {% if service != 'keepalived' %} {{lang.words.edit|title()}} {% endif %} {% endif %}
{% continue %} {% endif %} {% if line.startswith('defaults') %}
{{ line }} {% if role %} {{lang.words.edit|title()}} {% endif %}
{% continue %} {% endif %} {%- if line.startswith('listen') -%}
{{- line -}} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %} {%- set backend = line.split(' ') -%} {{lang.words.stats|title()}} {%- set backend = backend|join('_') -%} {%- do section_name.update({i: backend}) -%}
{% continue %} {%- endif -%} {%- if line.startswith('frontend') -%}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %} {% set backend = line.split(' ') %} {{lang.words.stats|title()}} {% set backend = backend|join('_') %} {% do section_name.update({i: backend}) %}
{% continue %} {%- endif -%} {% if line.startswith('backend') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %} {% set backend = line.split(' ') %} {{lang.words.stats|title()}}
{% continue %} {% endif %} {% if line.startswith('cache') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %}
{% continue %} {% endif %} {% if line.startswith('peers') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %}
{% continue %} {% endif %} {% if line.startswith('resolvers') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %}
{% continue %} {% endif %} {% if line.startswith('userlist') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %}
{% continue %} {% endif %} {% if line.startswith('http-errors') %}
{{ line }} {% if role %} {{lang.words.edit|title()}}/{{lang.words.delete|title()}} {% endif %}
{% continue %} {% endif %} {% if "acl" in line or "option" in line or "server" in line %} {% if "timeout" not in line and "default-server" not in line and "#use_backend" not in line and "#" not in line%} {{ i }} {{ line }}
{% continue %} {% endif %} {% endif %} {% if line.startswith("#") %} {{ i }} {{ line }}
{% continue %} {% endif %} {% if line|length > 1 %} {{ i }} {{ line }}
{% endif %} {%- if "bind" in line and "@" not in line and "-" not in line -%} {%- set bind = line.split(':')[1] -%} {%- set bind = bind.split(' ') -%} {%- endif -%} {%- endif -%} {%- endfor -%}
{% if configver %}
{% if role <= 3 %} {% if not is_serv_protected or role <= 2 %}
{% if is_restart|int == 0 %} {% endif %} {% if service != 'keepalived' %} {% endif %}
{% endif %} {% endif %}
{{lang.words.note|title()}}: {{lang.phrases.master_slave|title()}}
{% endif %}