mirror of https://github.com/Aidaho12/haproxy-wi
v8.0: Refactor config logic to streamline cfg retrieval
Moved `cfg` retrieval inside the `if` block to ensure it is only fetched when `serv`, `edit`, and other conditions are met. Also, removed an unnecessary hidden input from the HTML template.pull/399/head
parent
4e5f4b2bd1
commit
cde708065b
|
@ -95,14 +95,12 @@ def config(service, serv, edit, config_file_name, new):
|
|||
is_serv_protected = ''
|
||||
new_config = new
|
||||
|
||||
if serv and config_file_name:
|
||||
cfg = config_mod.return_cfg(service, serv, config_file_name)
|
||||
|
||||
if serv and edit and new_config is None:
|
||||
roxywi_common.check_is_server_in_group(serv)
|
||||
is_serv_protected = server_sql.is_serv_protected(serv)
|
||||
server_id = server_sql.select_server_id_by_ip(serv)
|
||||
is_restart = service_sql.select_service_setting(server_id, service, 'restart')
|
||||
cfg = config_mod.return_cfg(service, serv, config_file_name)
|
||||
|
||||
try:
|
||||
error = config_mod.get_config(serv, cfg, service=service, config_file_name=config_file_name)
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
{% if g.user_params['role'] <= 3 %}
|
||||
<h4 class="left-space">{{lang.words.config|title()}} {% if config_file_name and config_file_name != 'undefined' %}{{config_file_name.replace('92', '/')}}{%endif%} {{lang.words.from}} {{ serv }}</h4>
|
||||
<form action="/config/{{service}}/{{serv}}" name="saveconfig" id="saveconfig" method="post" class="left-space">
|
||||
{# <input type="hidden" value="{{ serv }}" name="server_id">#}
|
||||
<input type="hidden" value="{{ cfg }}.old" name="config_local_path">
|
||||
<input type="hidden" value="{{ service }}" name="service">
|
||||
<input type="hidden" value="{{ config_file_name }}" name="file_name">
|
||||
|
|
Loading…
Reference in New Issue