From 58c7c41905e623cdfb985c799eac1670bdce22ba Mon Sep 17 00:00:00 2001 From: Mathias Kaufmann Date: Sun, 22 Apr 2018 10:44:21 +0200 Subject: [PATCH 1/3] Remove unused constant --- goircd.go | 1 - 1 file changed, 1 deletion(-) diff --git a/goircd.go b/goircd.go index 32cfe78..c84dbec 100644 --- a/goircd.go +++ b/goircd.go @@ -39,7 +39,6 @@ import ( const ( PROXY_TIMEOUT = 5 - HEALTCHECK_PORT = 8080 ) var ( From c7c83926e1a4e07591e65603c5ed8eb3c986d51a Mon Sep 17 00:00:00 2001 From: Mathias Kaufmann Date: Sun, 22 Apr 2018 10:45:02 +0200 Subject: [PATCH 2/3] Added argument (and env-var) to specify health-bind-address. --- goircd.go | 1 + 1 file changed, 1 insertion(+) diff --git a/goircd.go b/goircd.go index c84dbec..2725269 100644 --- a/goircd.go +++ b/goircd.go @@ -57,6 +57,7 @@ var ( metrics = flag.Bool("metrics", false, "Enable metrics export") verbose = flag.Bool("v", false, "Enable verbose logging.") healtcheck = flag.Bool("healthcheck", false, "Enable healthcheck endpoint.") + healtbind = flag.String("healthbind", "[::]:8086", "Healthcheck bind address and port.") clients_tls_total = prometheus.NewCounter( prometheus.CounterOpts{ From cf6cce277f39143cb0861c33920f2b692a67c8db Mon Sep 17 00:00:00 2001 From: Mathias Kaufmann Date: Sun, 22 Apr 2018 10:47:38 +0200 Subject: [PATCH 3/3] Use provided argument or fall-back for health-bind. The following arguments may used to specifiy health-check behavior: * `-healthcheck` : Enable healthcheck (default: `false`) * `-healthbind=[::1]:8086` : Override Healthcheck bind-address (default: `[::]:8086` Or use Environmentvariables `HEALTHCHECK` and `HEALTHBIND` --- goircd.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/goircd.go b/goircd.go index 2725269..a8b4576 100644 --- a/goircd.go +++ b/goircd.go @@ -207,13 +207,10 @@ func Run() { } func health_endpoint() { - var ( - health_bind = "0.0.0.0:8086" - ) health := healthchecking.NewHandler() health.AddLivenessCheck("goroutine-threshold", healthchecking.GoroutineCountCheck(100)) - log.Printf("Healthcheck listening on http://%s", health_bind) - http.ListenAndServe(health_bind, health) + log.Printf("Healthcheck listening on http://%s", *healtbind) + http.ListenAndServe(*healtbind, health) } func prom_export() {