1
0
Fork 0

Stats access requires custom password

This commit is contained in:
Joao Gilberto Magalhaes 2019-07-18 00:06:40 -05:00
parent 8afffcebd5
commit f283cb7131
2 changed files with 10 additions and 10 deletions

View file

@ -31,12 +31,12 @@ The mapping to `/var/run/docker.sock` is necessary to discover the docker contai
The environment variables will setup the HAProxy. The environment variables will setup the HAProxy.
| Environment Variable | Description | | Environment Variable | Description |
|----------------------|------------------------------------------------------------------| |----------------------|--------------------------------------------------------------------|
| DISCOVER | How `haproxy.cfg` will be created: `static`, `docker` or `swarm` | | DISCOVER | How `haproxy.cfg` will be created: `static`, `docker` or `swarm` |
| HAPROXY_USERNAME | The HAProxy username to the statistics | | HAPROXY_USERNAME | The HAProxy username to the statistics. Default: `admin` |
| HAPROXY_PASSWORD | The HAProxy password to the statistics | | HAPROXY_PASSWORD | The HAProxy password to the statistics. If not set disable stats. |
| HAPROXY_STATS_PORT | The HAProxy port to the statistics | | HAPROXY_STATS_PORT | The HAProxy port to the statistics. Default: `1936` |
| HAPROXY_CUSTOMERRORS | If HAProxy will use custom HTML errors. true/false | | HAPROXY_CUSTOMERRORS | If HAProxy will use custom HTML errors. true/false. Default: false |

View file

@ -12,11 +12,11 @@ result = {
"easymapping": [], "easymapping": [],
"customerrors": True if os.getenv("HAPROXY_CUSTOMERRORS") == "true" else False "customerrors": True if os.getenv("HAPROXY_CUSTOMERRORS") == "true" else False
} }
if os.getenv("HAPROXY_USERNAME"): if os.getenv("HAPROXY_PASSWORD"):
result["stats"] = { result["stats"] = {
"username": os.getenv("HAPROXY_USERNAME"), "username": os.getenv("HAPROXY_USERNAME") if os.getenv("HAPROXY_USERNAME") else "admin",
"password": os.getenv("HAPROXY_PASSWORD"), "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: for line in lineList: