Add custom options in General Settings/Statistics Configuration

This commit is contained in:
Manus Freedom 2016-06-07 23:10:14 +02:00
parent 6ed7455d9b
commit 661646c218
3 changed files with 24 additions and 2 deletions

View file

@ -196,6 +196,13 @@
<help><![CDATA[Grant access to HAProxy statistics page. Please provide both user and password in clear text separated by a ':', i.e. john:secret123 or jdoe:anonymous. Use TAB key to complete adding a user.]]></help>
<hint>Enter user:password here. Finish with TAB.</hint>
</field>
<field>
<id>haproxy.general.stats.customOptions</id>
<label>Custom options</label>
<type>textbox</type>
<help><![CDATA[These lines will be added to the statistics settings of to the HAProxy configuration file.<br/><div class="text-info"><b>NOTE:</b> The syntax will not be checked, use at your own risk!</div>]]></help>
<advanced>true</advanced>
</field>
</subtab>
</tab>

View file

@ -211,6 +211,9 @@
<mask>/^((([0-9a-zA-Z._\-]+:[0-9a-zA-Z._\-]+)([,]){0,1}))*/u</mask>
<ValidationMessage>Please provide a valid user and password, i.e. user:secret123.</ValidationMessage>
</users>
<customOptions type="TextField">
<Required>N</Required>
</customOptions>
</stats>
</general>
<frontends>

View file

@ -796,6 +796,12 @@ listen local_statistics
stats uri /haproxy?stats
stats realm HAProxy\ statistics
stats admin if TRUE
{% if OPNsense.HAProxy.general.stats.customOptions|default("") != "" %}
# WARNING: pass through options below this line
{% for customOpt in OPNsense.HAProxy.general.stats.customOptions.split("\n") %}
{{customOpt}}
{% endfor %}
{% endif %}
{# # remote stats are optional #}
{% if OPNsense.HAProxy.general.stats.remoteEnabled|default("") == "1" %}
@ -816,9 +822,15 @@ listen remote_statistics
{% endfor %}
{% endif %}
{% endif %}
{% else %}
{% if OPNsense.HAProxy.general.stats.customOptions|default("") != "" %}
# WARNING: pass through options below this line
{% for customOpt in OPNsense.HAProxy.general.stats.customOptions.split("\n") %}
{{customOpt}}
{% endfor %}
{% endif %}
{% else %}
# ERROR: remote statistics disabled, because no listen address was specified
{% endif %}
{% endif %}
{% endif %}
{% else %}
# statistics are DISABLED