-
{{ lang._("%sChoose a command to change a server's state in runtime:%s") | format('', '') }}
+
{{ lang._("%sThe following commands are available to change a server's state in runtime:%s") | format('', '') }}
- {{ lang._('%sSet state to ready:%s This puts the server in normal mode.') | format('', '') }}
- {{ lang._('%sSet state to drain:%s This removes the server from load balancing. Health checks will continue to run and it still accepts new persistent connections.') | format('', '') }}
diff --git a/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportLuaScripts.php b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportLuaScripts.php
index d0da858af..82243d95f 100755
--- a/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportLuaScripts.php
+++ b/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportLuaScripts.php
@@ -2,7 +2,7 @@
OPNsense->HAProxy->luas)) {
}
$lua_name = (string)$lua->name;
$lua_id = (string)$lua->id;
- if ($lua_id != "") {
- $lua_content = htmlspecialchars_decode(str_replace("\r", "", (string)$lua->content));
- $lua_filename = $export_path . $lua_id . ".lua";
- file_put_contents($lua_filename, $lua_content);
- chmod($lua_filename, 0600);
- echo "lua script exported to " . $lua_filename . "\n";
+ $lua_filename_scheme = (string)$lua->filename_scheme;
+ if ($lua_filename_scheme != '' and $lua_filename_scheme === 'name') {
+ $_name_alnum = preg_replace("/[^A-Za-z0-9]/", '', $lua_name);
+ $lua_filename = $export_path . $_name_alnum . '.lua';
+ } else {
+ $lua_filename = $export_path . $lua_id . '.lua';
}
+ $lua_content = htmlspecialchars_decode(str_replace("\r", "", (string)$lua->content));
+ file_put_contents($lua_filename, $lua_content);
+ chmod($lua_filename, 0600);
+ chown($lua_filename, 'www');
+ echo "lua script exported to " . $lua_filename . "\n";
}
}
diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
index d6e0624ef..4ce226be3 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
@@ -994,13 +994,20 @@ global
{% do logging.append('len ' ~ OPNsense.HAProxy.general.logging.length) if OPNsense.HAProxy.general.logging.length|default("") != "" %}
{% do logging.append(OPNsense.HAProxy.general.logging.facility) %}
{% do logging.append(OPNsense.HAProxy.general.logging.level) if OPNsense.HAProxy.general.logging.level|default("") != "" %}
- log {{logging|join(' ')}}
+ log {{logging|join(' ')}}
+{# # lua scripts #}
+ lua-prepend-path /tmp/haproxy/lua/?.lua
{% if helpers.exists('OPNsense.HAProxy.luas.lua') %}
- # lua scripts
{% for lua in helpers.toList('OPNsense.HAProxy.luas.lua') %}
-{% if lua.enabled == '1' %}
+{% if lua.enabled == '1' and lua.preload|default('') == '1' %}
+{# # select the filename scheme for lua scripts #}
+{% if lua.filename_scheme|default('id') == 'name' %}
+{% set lua_filename = lua.name | regex_replace ("[^A-Za-z0-9]","") %}
+{% else %}
+{% set lua_filename = lua.id %}
+{% endif %}
# lua script: {{lua.name}}
- lua-load /tmp/haproxy/lua/{{lua.id}}.lua
+ lua-load /tmp/haproxy/lua/{{lua_filename}}.lua
{% endif %}
{% endfor %}
{% endif %}