From f283cb713134582de85c45874711c58ecde44565 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Thu, 18 Jul 2019 00:06:40 -0500 Subject: [PATCH] Stats access requires custom password --- README.md | 14 +++++++------- swarm.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d03b23c..b09614e 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ The mapping to `/var/run/docker.sock` is necessary to discover the docker contai The environment variables will setup the HAProxy. -| Environment Variable | Description | -|----------------------|------------------------------------------------------------------| -| DISCOVER | How `haproxy.cfg` will be created: `static`, `docker` or `swarm` | -| HAPROXY_USERNAME | The HAProxy username to the statistics | -| HAPROXY_PASSWORD | The HAProxy password to the statistics | -| HAPROXY_STATS_PORT | The HAProxy port to the statistics | -| HAPROXY_CUSTOMERRORS | If HAProxy will use custom HTML errors. true/false | +| Environment Variable | Description | +|----------------------|--------------------------------------------------------------------| +| DISCOVER | How `haproxy.cfg` will be created: `static`, `docker` or `swarm` | +| HAPROXY_USERNAME | The HAProxy username to the statistics. Default: `admin` | +| HAPROXY_PASSWORD | The HAProxy password to the statistics. If not set disable stats. | +| HAPROXY_STATS_PORT | The HAProxy port to the statistics. Default: `1936` | +| HAPROXY_CUSTOMERRORS | If HAProxy will use custom HTML errors. true/false. Default: false | diff --git a/swarm.py b/swarm.py index 20b67f8..f180a26 100644 --- a/swarm.py +++ b/swarm.py @@ -12,11 +12,11 @@ result = { "easymapping": [], "customerrors": True if os.getenv("HAPROXY_CUSTOMERRORS") == "true" else False } -if os.getenv("HAPROXY_USERNAME"): +if os.getenv("HAPROXY_PASSWORD"): result["stats"] = { - "username": os.getenv("HAPROXY_USERNAME"), + "username": os.getenv("HAPROXY_USERNAME") if os.getenv("HAPROXY_USERNAME") else "admin", "password": os.getenv("HAPROXY_PASSWORD"), - "port": os.getenv("HAPROXY_STATS_PORT"), + "port": os.getenv("HAPROXY_STATS_PORT") if os.getenv("HAPROXY_STATS_PORT") else "1936", } for line in lineList: