diff options
Diffstat (limited to 'config/haproxy-devel/haproxy.inc')
-rw-r--r-- | config/haproxy-devel/haproxy.inc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc index 3afefb49..5eee1024 100644 --- a/config/haproxy-devel/haproxy.inc +++ b/config/haproxy-devel/haproxy.inc @@ -459,7 +459,7 @@ function write_backend($fd, $name, $pool, $frontend) { $adv_be = explode("\n", base64_decode($pool['advanced_backend'])); foreach($adv_be as $adv_line) { if ($adv_line != "") { - fwrite($fd, "\t" . $adv_line . "\n"); + fwrite($fd, "\t" . str_replace("\r", "", $adv_line) . "\n"); } } } @@ -486,7 +486,7 @@ function write_backend($fd, $name, $pool, $frontend) { if (is_array($a_servers)) { foreach($a_servers as $be) { - if (!$be['status'] == "inactive") + if ($be['status'] == "inactive") continue; if (!$be['name']) @@ -573,7 +573,8 @@ function haproxy_writeconf($configfile) { if($a_global['advanced']) { $adv = explode("\n", base64_decode($a_global['advanced'])); foreach($adv as $adv_line) { - fwrite($fd, "\t" . $adv_line . "\n"); + fwrite($fd, "\t" . str_replace("\r", "", $adv_line) . "\n"); + } } fwrite ($fd, "\n"); @@ -687,7 +688,7 @@ function haproxy_writeconf($configfile) { $advanced = explode("\n", base64_decode($bind['advanced'])); foreach($advanced as $adv_line) { if ($adv_line != "") { - fwrite($fd, "\t" . $adv_line . "\n"); + fwrite($fd, "\t" . str_replace("\r", "", $adv_line) . "\n"); } } } @@ -727,7 +728,7 @@ function haproxy_writeconf($configfile) { // Combine the rest of the listener configs - $default_once = 0; + $default_backend = ""; $i = 0; foreach ($bind['config'] as $bconfig) { $a_acl=&$bconfig['ha_acls']['item']; @@ -741,9 +742,8 @@ function haproxy_writeconf($configfile) { $poolname .= "_" . $bconfig['svrport']; // Write this out once, and must be before any backend config text - if ($default_once == 0) { - fwrite ($fd, "\tdefault_backend\t\t" . $poolname . "\n"); - $default_once++; + if ($default_backend == "" || $bconfig['secondary'] != 'yes') { + $default_backend = $poolname; } if (!isset($a_pendingpl[$poolname])) { @@ -789,6 +789,8 @@ function haproxy_writeconf($configfile) { fwrite ($fd, "\tuse_backend\t\t" . $poolname . " if " . $aclnames . "\n"); } } + fwrite ($fd, "\tdefault_backend\t\t" . $default_backend . "\n"); + foreach($advancedextra as $extra) fwrite ($fd, "\t".$extra."\n"); fwrite ($fd, "\n"); |