2021-05-16 05:27:47 +00:00
< div style = "text-align: center;" >
2022-01-16 13:50:53 +00:00
< h4 > Config {% if config_file_name != 'undefined' %}{{config_file_name.replace('92', '/')}}{%endif%} from {{serv}}< / h4 >
2018-08-14 05:59:21 +00:00
< p class = "accordion-expand-holder" >
2021-05-16 05:27:47 +00:00
{% if role < = 3 %}
{% if not is_serv_protected or role < = 2 %}
2022-09-02 14:12:28 +00:00
< a class = "ui-button ui-widget ui-corner-all" title = "Edit this run config" id = "edit_link" href = "config.py?service={{service}}&serv={{serv}}&open=open&config_file_name={{config_file_name}}" > Edit< / a >
2022-02-02 20:23:33 +00:00
{% if service == 'haproxy' %}
< a class = "ui-button ui-widget ui-corner-all" title = "Add proxy" href = "add.py#proxy" > Add< / a >
{% elif service == 'keepalived' %}
< a class = "ui-button ui-widget ui-corner-all" title = "Add VRRP" href = "ha.py" > Add< / a >
{% endif %}
2021-05-16 05:27:47 +00:00
{% endif %}
2020-02-05 08:15:57 +00:00
{% endif %}
2022-09-02 14:12:28 +00:00
< a class = "accordion-expand-all ui-button ui-widget ui-corner-all" id = "expand_link" href = "#" > Expand all< / a >
2020-03-27 21:16:04 +00:00
< button id = "raw" > Raw< / button >
< button id = "according" style = "display: none;" > According< / button >
2018-08-14 05:59:21 +00:00
< / p >
2021-05-16 05:27:47 +00:00
< / div >
2020-03-27 21:16:04 +00:00
2018-08-14 05:59:21 +00:00
< div style = "margin-left: 16%" class = "configShow" >
{% set i = 0 -%}
2019-11-18 18:53:09 +00:00
{% set section_name = {} %}
{% for line in conf -%}
2018-08-14 05:59:21 +00:00
{% set i = i + loop.index0 %}
2019-05-13 20:07:32 +00:00
{% if not role %}
2020-03-27 21:16:04 +00:00
{% if line.startswith('#HideBlockStart') %}
<!-- {{line}}
2022-11-28 07:47:18 +00:00
{% continue %}
2020-03-27 21:16:04 +00:00
{% endif %}
{% if line.startswith('#HideBlockEnd') %}
{{line}}-->
2022-11-28 07:47:18 +00:00
{% continue %}
2020-03-27 21:16:04 +00:00
{% endif %}
2018-08-14 05:59:21 +00:00
{% endif %}
2020-03-27 21:16:04 +00:00
{% if service == 'nginx' %}
2022-01-16 13:50:53 +00:00
{% if i == 0 and "server {" not in line %}
< span class = "param" >
< / span > < div >
< span class = "configLine" >
< span class = "numRow" > {{ i }}< / span >
    {{ line }}
< / span > < br / >
{% continue %}
{% endif %}
2022-11-28 07:47:18 +00:00
{%- if "server {" in line -%}
2020-03-27 21:16:04 +00:00
{% if i > 1 %}
< / div >
2019-09-20 06:42:19 +00:00
{% endif %}
2020-03-27 21:16:04 +00:00
< span class = "param" > {{ line }}
2019-09-20 06:42:19 +00:00
< / span > < div >
2019-11-18 18:53:09 +00:00
{% continue %}
2020-03-27 21:16:04 +00:00
{% endif %}
2021-06-02 07:28:07 +00:00
{%- if "stream {" in line -%}
{% if i > 1 %}
< / div >
{% endif %}
< span class = "param" > {{ line }}
< / span > < div >
{% continue %}
{% endif %}
2022-01-16 13:50:53 +00:00
{%- if "http {" in line -%}
{% if i > 1 %}
< / div >
{% endif %}
< span class = "param" > {{ line }}
< / span > < div >
{% continue %}
{% endif %}
{%- if "events {" in line -%}
< / div >
< span class = "param" > {{ line }}
< / span > < div >
{% continue %}
{% endif %}
2020-03-27 21:16:04 +00:00
{% if "listen " in line or "location" in line or "server_name" in line or "}" in line %}
{% if "#" not in line %}
< span class = "numRow" >
{{ i }}
2022-11-28 07:47:18 +00:00
< / span >
2020-03-27 21:16:04 +00:00
< span class = "paramInSec" >
2022-11-28 07:47:18 +00:00
  {{ line }}
2020-03-27 21:16:04 +00:00
< / span > < br / >
{% continue %}
2019-09-20 06:42:19 +00:00
{% endif %}
2020-03-27 21:16:04 +00:00
{% endif %}
{% if "#" in line %}
< span class = "numRow" >
{{ i }}
2019-09-26 15:48:56 +00:00
< / span >
2020-03-27 21:16:04 +00:00
< span class = "comment" >
  {{ line }}
< / span > < br / >
2022-11-28 07:47:18 +00:00
{% continue %}
2020-03-27 21:16:04 +00:00
{% endif %}
{% if line|length > 1 %}
< span class = "configLine" >
2022-11-28 07:47:18 +00:00
< span class = "numRow" > {{ i }}< / span >
2020-03-27 21:16:04 +00:00
    {{ line }}
2022-11-28 07:47:18 +00:00
< / span > < br / >
2020-03-27 21:16:04 +00:00
{% endif %}
2022-07-08 14:40:45 +00:00
{% elif service == 'apache' %}
{% if i == 0 and "< VirtualHost " not in line % }
< span class = "param" >
< / span > < div >
< span class = "configLine" >
< span class = "numRow" > {{ i }}< / span >
    {{ line }}
< / span > < br / >
{% continue %}
{% endif %}
{%- if "< VirtualHost " in line - % }
{% if i > 1 %}
< / div >
{% endif %}
< span class = "param" > {{ line }}
< / span > < div >
{% continue %}
{% endif %}
{% if "< " 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 %}
2021-07-01 07:19:23 +00:00
{% 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 %}
2022-02-02 20:23:33 +00:00
{%- if "virtual_server " in line -%}
{% if i > 1 %}
< / div >
{% endif %}
< span class = "param" > {{ line }}
< / span > < div >
{% continue %}
{% endif %}
2021-07-01 07:19:23 +00:00
{%- 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 %}
2020-03-27 21:16:04 +00:00
{% 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 %}
2019-09-20 06:42:19 +00:00
< / span > < div >
2020-03-27 21:16:04 +00:00
{% continue %}
{% endif %}
{% if line.startswith('defaults') %}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2019-10-07 17:07:28 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
{%- if line.startswith('listen') -%}
< / div > < span class = "param" > {{- line -}}
{% if role %}
2019-10-07 17:07:28 +00:00
< span class = "accordion-link" >
2022-11-28 07:47:18 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" target = "_blank" > Edit/Delete< / a >
2019-10-07 17:07:28 +00:00
< / span >
2020-03-27 21:16:04 +00:00
{% endif %}
{%- set backend = line.split(' ') -%}
2019-12-30 16:41:16 +00:00
< span class = "accordion-link" >
2022-08-15 08:50:29 +00:00
< a href = "/app/statsview.py?service=haproxy&serv={{-serv-}}#{{- backend[1]-}}" target = "_blank" > Stats< / a >
2019-12-30 16:41:16 +00:00
< / span >
2020-03-27 21:16:04 +00:00
{%- set backend = backend|join('_') -%}
{%- do section_name.update({i: backend}) -%}
2022-11-28 07:47:18 +00:00
< span id = "{{-section_name[i]|replace('\n', '')-}}" class = "accordion-link" target = "_blank" > < / span >
< / span > < div >
2020-03-27 21:16:04 +00:00
{% continue %}
{%- endif -%}
{%- if line.startswith('frontend') -%}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
2022-11-28 07:47:18 +00:00
{% endif %}
2020-03-27 21:16:04 +00:00
{% set backend = line.split(' ') %}
2019-10-18 17:23:35 +00:00
< span class = "accordion-link" >
2022-08-15 08:50:29 +00:00
< a href = "/app/statsview.py?serv={{serv}}#{{ backend[1]}}" target = "_blank" > Stats< / a >
2022-11-28 07:47:18 +00:00
< / span >
2020-03-27 21:16:04 +00:00
{% set backend = backend|join('_') %}
{% do section_name.update({i: backend}) %}
2022-11-28 07:47:18 +00:00
< span id = "{{section_name[i]|replace('\n', '')}}" class = "accordion-link" > < / span >
< / span > < div >
2020-03-27 21:16:04 +00:00
{% continue %}
{%- endif -%}
{% if line.startswith('backend') %}
2022-11-28 07:47:18 +00:00
< / div > < span class = "param" > {{ line }}
2020-03-27 21:16:04 +00:00
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
{% set backend = line.split(' ') %}
< span class = "accordion-link" >
2022-08-15 08:50:29 +00:00
< a href = "/app/statsview.py?serv={{serv}}#{{ backend[1]}}" target = "_blank" > Stats< / a >
2019-10-18 17:23:35 +00:00
< / span >
2020-03-27 21:16:04 +00:00
< / span > < div >
{% continue %}
{% endif %}
{% if line.startswith('cache') %}
2022-11-28 07:47:18 +00:00
< / div > < span class = "param" > {{ line }}
2020-03-27 21:16:04 +00:00
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
{% if line.startswith('peers') %}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
{% if line.startswith('resolvers') %}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
{% if line.startswith('userlist') %}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2020-03-27 21:16:04 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
2021-01-02 16:36:43 +00:00
{% if line.startswith('http-errors') %}
< / div > < span class = "param" > {{ line }}
{% if role %}
< span class = "accordion-link" >
2021-04-16 14:09:51 +00:00
< a href = "/app/sections.py?serv={{serv}}§ion={{ line }}" > Edit/Delete< / a >
2021-01-02 16:36:43 +00:00
< / span >
{% endif %}
< / span > < div >
{% continue %}
{% endif %}
2020-03-27 21:16:04 +00:00
{% 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%}
2018-08-14 05:59:21 +00:00
< span class = "numRow" >
{{ i }}
2022-11-28 07:47:18 +00:00
< / span >
2020-03-27 21:16:04 +00:00
< span class = "paramInSec" >
2022-11-28 07:47:18 +00:00
{{ line }}
2020-03-27 21:16:04 +00:00
< / span > < br / >
{% continue %}
{% endif %}
2018-08-14 05:59:21 +00:00
{% endif %}
2020-03-27 21:16:04 +00:00
{% if line.startswith("#") %}
2018-08-14 09:54:39 +00:00
< span class = "numRow" >
{{ i }}
< / span >
2020-03-27 21:16:04 +00:00
< span class = "comment" >
2019-10-25 07:18:57 +00:00
{{ line }}
2020-03-27 21:16:04 +00:00
< / span > < br / >
2022-11-28 07:47:18 +00:00
{% continue %}
2020-03-27 21:16:04 +00:00
{% endif %}
{% if line|length > 1 %}
< span class = "configLine" >
2022-11-28 07:47:18 +00:00
< span class = "numRow" > {{ i }}< / span >
2020-03-27 21:16:04 +00:00
{{ line }}
2022-11-28 07:47:18 +00:00
< / span > < br / >
2020-03-27 21:16:04 +00:00
{% endif %}
2021-11-05 08:55:05 +00:00
{%- if "bind" in line and "@" not in line and "-" not in line -%}
2021-04-16 14:09:51 +00:00
{%- set bind = line.split(':')[1] -%}
{%- set bind = bind.split(' ') -%}
2020-03-27 21:16:04 +00:00
< script >
{% set k = i - 1 %}
2021-04-16 14:09:51 +00:00
$('#{{-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 > ')
2020-03-27 21:16:04 +00:00
< / script >
{%- endif -%}
2019-11-18 18:53:09 +00:00
{%- endif -%}
{%- endfor -%}
2018-08-14 05:59:21 +00:00
< / div >
< / div >
{% if configver %}
< br >
2021-07-14 16:14:59 +00:00
< center >
2021-05-16 05:27:47 +00:00
{% if role < = 3 %}
{% if not is_serv_protected or role < = 2 %}
2020-02-02 14:23:00 +00:00
< form action = "versions.py?service={{service}}" method = "post" >
2018-08-14 05:59:21 +00:00
< input type = "hidden" value = "{{serv}}" name = "serv" >
< input type = "hidden" value = "{{configver}}" name = "configver" >
< input type = "hidden" value = "1" name = "config" >
2021-09-14 06:02:05 +00:00
< button type = 'submit' value = 'save' name = 'save' class = 'btn btn-default' title = "Save config without reloading the service" > Save< / button >
2022-08-17 17:23:25 +00:00
{% if is_restart|int == 0 %}
2019-09-17 07:18:48 +00:00
< button type = 'submit' value = '' name = '' class = 'btn btn-default' > Upload and restart< / button >
2022-08-17 17:23:25 +00:00
{% endif %}
2020-02-02 14:23:00 +00:00
{% if service != 'keepalived' %}
2019-10-01 05:35:05 +00:00
< button type = 'submit' value = 'reload' name = 'save' class = 'btn btn-default' > Upload and reload< / button >
2020-02-02 14:23:00 +00:00
{% endif %}
2018-08-14 05:59:21 +00:00
< / form >
2021-05-16 05:27:47 +00:00
{% endif %}
{% endif %}
2021-09-14 06:02:05 +00:00
< div class = "alert alert-info" > < b > Note:< / b > If you reconfigure Master server, Slave will be reconfigured automatically< / div >
2021-07-14 16:14:59 +00:00
< / center >
2022-09-02 14:12:28 +00:00
{% endif %}
< script >
{% if role < = 3 %}
{% if not is_serv_protected or role < = 2 %}
$(document).bind('keydown', 'e', function (){
window.location = document.getElementById('edit_link').href;
});
{% endif %}
{% endif %}
$(document).on('keydown', null, 'r', raw_button);
function raw_button(event) {
$("#raw").trigger("click");
}
$(document).on('keydown', null, 'a', according_button);
function according_button(event) {
$("#according").click();
}
$(document).on('keydown', null, 'x', expand_button);
function expand_button(event) {
$("#expand_link").click();
}
< / script >