From a437b28cb0bb518b6e48e6e1704b839faa8f288f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 22 Feb 2023 18:50:03 +0100 Subject: [PATCH] Code: small refactor, HA template: TCP backend fix --- index.js | 8 ++++---- rproxy.handlebars | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index ca3d4ee..1c6ed10 100644 --- a/index.js +++ b/index.js @@ -33,10 +33,6 @@ async function updateProxy(firstRun) { }; } - function sortFn(a, b) { - return a.name > b.name ? 1 : a.name < b.name ? -1 : 0; - } - const workers = []; const managers = []; @@ -85,6 +81,10 @@ async function updateProxy(firstRun) { } } + function sortFn(a, b) { + return a.name > b.name ? 1 : a.name < b.name ? -1 : 0; + } + for (const list of [workers, managers, http, tcp, udp]) list.sort(sortFn); diff --git a/rproxy.handlebars b/rproxy.handlebars index 34af26b..f3c78c8 100644 --- a/rproxy.handlebars +++ b/rproxy.handlebars @@ -49,6 +49,7 @@ backend {{name}} {{#each tcp}} listen {{name}}:{{port}} + bind :{{port}} mode tcp {{#each ../workers}} server {{name}} {{address}}:{{../port}} check