mirror of https://github.com/Aidaho12/haproxy-wi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
302 lines
8.9 KiB
302 lines
8.9 KiB
<div style="text-align: center;">
|
|
<h4>Config from {{serv}}</h4>
|
|
<p class="accordion-expand-holder">
|
|
{% if role <= 3 %}
|
|
{% if not is_serv_protected or role <= 2 %}
|
|
<a class="ui-button ui-widget ui-corner-all" title="Edit this run config" href="config.py?service={{service}}&serv={{serv}}&open=open">Edit</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
<a class="accordion-expand-all ui-button ui-widget ui-corner-all" href="#">Expand all</a>
|
|
<button id="raw">Raw</button>
|
|
<button id="according" style="display: none;">According</button>
|
|
</p>
|
|
</div>
|
|
|
|
<div style="margin-left: 16%" class="configShow">
|
|
{% set i = 0 -%}
|
|
{% set section_name = {} %}
|
|
{% for line in conf -%}
|
|
{% set i = i + loop.index0 %}
|
|
{% if not role %}
|
|
{% if line.startswith('#HideBlockStart') %}
|
|
<!--{{line}}
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('#HideBlockEnd') %}
|
|
{{line}}-->
|
|
{% continue %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if service == 'nginx' %}
|
|
{%- if "server {" in line -%}
|
|
{% if i > 1 %}
|
|
</div>
|
|
{% endif %}
|
|
<span class="param">{{ line }}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{%- if "stream {" in line -%}
|
|
{% if i > 1 %}
|
|
</div>
|
|
{% endif %}
|
|
<span class="param">{{ line }}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if "listen " in line or "location" in line or "server_name" in line or "}" in line %}
|
|
{% if "#" not in line %}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="paramInSec">
|
|
 {{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if "#" in line %}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="comment">
|
|
 {{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line|length > 1 %}
|
|
<span class="configLine">
|
|
<span class="numRow">{{ i }}</span>
|
|
  {{ line }}
|
|
</span><br />
|
|
{% endif %}
|
|
{% elif service == 'keepalived' %}
|
|
{%- if "global_defs {" in line -%}
|
|
{% if i > 1 %}
|
|
</div>
|
|
{% endif %}
|
|
<span class="param">{{ line }}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{%- if "vrrp_instance " in line -%}
|
|
{% if i > 1 %}
|
|
</div>
|
|
{% endif %}
|
|
<span class="param">{{ line }}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{%- if "vrrp_script " in line -%}
|
|
{% if i > 1 %}
|
|
</div>
|
|
{% endif %}
|
|
<span class="param">{{ line }}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if "state " in line or "interface" in line or "priority" in line or "}" in line %}
|
|
{% if "#" not in line %}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="paramInSec">
|
|
  {{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if "#" in line %}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="comment">
|
|
  {{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line|length > 1 %}
|
|
<span class="configLine">
|
|
<span class="numRow">{{ i }}</span>
|
|
  {{ line }}
|
|
</span><br />
|
|
{% endif %}
|
|
{% else %}
|
|
{% if line.startswith('global') %}
|
|
<span class="param">{{ line }}
|
|
{% if role %}
|
|
{% if service != 'keepalived' %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
|
</span>
|
|
{% endif %}
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('defaults') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{%- if line.startswith('listen') -%}
|
|
</div><span class="param">{{- line -}}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
{%- set backend = line.split(' ') -%}
|
|
<span class="accordion-link">
|
|
<a href="/app/viewsttats.py?service=haproxy&serv={{-serv-}}#{{- backend[1]-}}" target="_blank">Stats</a>
|
|
</span>
|
|
{%- set backend = backend|join('_') -%}
|
|
{%- do section_name.update({i: backend}) -%}
|
|
<span id="{{-section_name[i]|replace('\n', '')-}}" class="accordion-link"></span>
|
|
</span><div>
|
|
{% continue %}
|
|
{%- endif -%}
|
|
{%- if line.startswith('frontend') -%}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
{% set backend = line.split(' ') %}
|
|
<span class="accordion-link">
|
|
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}" target="_blank">Stats</a>
|
|
</span>
|
|
{% set backend = backend|join('_') %}
|
|
{% do section_name.update({i: backend}) %}
|
|
<span id="{{section_name[i]|replace('\n', '')}}" class="accordion-link"></span>
|
|
</span><div>
|
|
{% continue %}
|
|
{%- endif -%}
|
|
{% if line.startswith('backend') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
{% set backend = line.split(' ') %}
|
|
<span class="accordion-link">
|
|
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}" target="_blank">Stats</a>
|
|
</span>
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('cache') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('peers') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('resolvers') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('userlist') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line.startswith('http-errors') %}
|
|
</div><span class="param">{{ line }}
|
|
{% if role %}
|
|
<span class="accordion-link">
|
|
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit/Delete</a>
|
|
</span>
|
|
{% endif %}
|
|
</span><div>
|
|
{% 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%}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="paramInSec">
|
|
{{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if line.startswith("#") %}
|
|
<span class="numRow">
|
|
{{ i }}
|
|
</span>
|
|
<span class="comment">
|
|
{{ line }}
|
|
</span><br />
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if line|length > 1 %}
|
|
<span class="configLine">
|
|
<span class="numRow">{{ i }}</span>
|
|
{{ line }}
|
|
</span><br />
|
|
{% endif %}
|
|
{%- if "bind" in line -%}
|
|
{%- set bind = line.split(':')[1] -%}
|
|
{%- set bind = bind.split(' ') -%}
|
|
<script>
|
|
{% set k = i - 1 %}
|
|
$('#{{-section_name[k]|replace("\n", "")-}}').html('<a href="http://{{-serv-}}:{{-bind[0]|replace("\n", "")-}}" title="Open {{serv-}}:{{-bind[0]|replace("\n", "")-}}" target="_blank">Open</a>')
|
|
</script>
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
</div>
|
|
</div>
|
|
{% if configver %}
|
|
<br>
|
|
<center>
|
|
{% if role <= 3 %}
|
|
{% if not is_serv_protected or role <= 2 %}
|
|
<form action="versions.py?service={{service}}" method="post">
|
|
<input type="hidden" value="{{serv}}" name="serv">
|
|
<input type="hidden" value="{{configver}}" name="configver">
|
|
<input type="hidden" value="1" name="config">
|
|
<button type='submit' value='save' name='save' class='btn btn-default'>Just save</button>
|
|
<button type='submit' value='' name='' class='btn btn-default'>Upload and restart</button>
|
|
{% if service != 'keepalived' %}
|
|
<button type='submit' value='reload' name='save' class='btn btn-default'>Upload and reload</button>
|
|
{% endif %}
|
|
</form>
|
|
{% endif %}
|
|
{% endif %}
|
|
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
|
|
</center>
|
|
{% endif %} |