diff options
Diffstat (limited to 'config/haproxy/haproxy.inc')
-rw-r--r-- | config/haproxy/haproxy.inc | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/config/haproxy/haproxy.inc b/config/haproxy/haproxy.inc index 1e29f358..45dce95c 100644 --- a/config/haproxy/haproxy.inc +++ b/config/haproxy/haproxy.inc @@ -58,6 +58,9 @@ $a_acltypes[] = array('name' => 'path_contains', 'descr' => 'Path contains', $a_acltypes[] = array('name' => 'source_ip', 'descr' => 'Source IP', 'mode' => '', 'syntax' => 'src'); +//$a_acltypes[] = array('name' => 'ssl_sni_matches', 'descr' => 'Server Name Indication TLS extension matches', +// 'mode' => 'https', 'syntax' => 'req_ssl_sni -i'); + function haproxy_custom_php_deinstall_command() { exec("cd /var/db/pkg && pkg_delete `ls | grep haproxy`"); exec("rm /usr/local/pkg/haproxy.inc"); @@ -186,7 +189,7 @@ EOD; /* link to frontend */ foreach ($a_backends as $id => $be) { if ($a_backends[$id]['name'] == $oldserver['backend']) { - $a_backends[$id]['pool'] = $pool['name']; + $a_backends[$id]['backend_serverpool'] = $pool['name']; $pool['monitor_uri'] = $be['monitor_uri']; unset($a_backends[$id]['monitor_uri']); break; @@ -201,6 +204,29 @@ EOD; unset($config['installedpackages']['haproxy']['ha_servers']); write_config(); } + + /* XML update to: pkg v1.3 and 'pool' changed to 'backend_serverpool' because 'pool' was added to listtags() in xmlparse.inc */ + if (is_array($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool'])) + { + foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend) + { + $backend_serverpool = $frontend['pool'][0]; + $frontend['backend_serverpool'] = $backend_serverpool; + unset($frontend['pool']); + } + write_config(); + } + //also move setting for existing 2.0 installations as only the new variable is used + if (isset($config['installedpackages']['haproxy']['ha_backends']['item'][0]['pool'])) + { + foreach($config['installedpackages']['haproxy']['ha_backends']['item'] as &$frontend) + { + $backend_serverpool = $frontend['pool']; + $frontend['backend_serverpool'] = $backend_serverpool; + unset($frontend['pool']); + } + write_config(); + } conf_mount_ro(); @@ -420,7 +446,7 @@ function haproxy_writeconf() { foreach ($a_backends as $backend) { if($backend['status'] != 'active') continue; - if(!$backend['pool']) + if(!$backend['backend_serverpool']) continue; $bname = $backend['extaddr'] . ":" . $backend['port']; @@ -519,7 +545,7 @@ function haproxy_writeconf() { if(!is_array($a_acl)) $a_acl=array(); - $poolname = $bconfig['pool'] . "_" . strtolower($bconfig['type']); + $poolname = $bconfig['backend_serverpool'] . "_" . strtolower($bconfig['type']); // Create different pools if the svrport is set if ($bconfig['svrport'] > 0) @@ -564,7 +590,7 @@ function haproxy_writeconf() { if (is_array($a_pendingpl) && is_array($a_pools)) { foreach ($a_pendingpl as $pending) { foreach ($a_pools as $pool) { - if ($pending['frontend']['pool'] == $pool['name']) { + if ($pending['frontend']['backend_serverpool'] == $pool['name']) { write_backend($fd, $pending['name'], $pool, $pending['frontend']); } } |