allow HAPROXY_PASSWORD to be a path to a Docker secret - resolve if so
This commit is contained in:
parent
2e45690fed
commit
e8becef76d
1 changed files with 5 additions and 1 deletions
|
|
@ -10,9 +10,13 @@ result = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.getenv("HAPROXY_PASSWORD"):
|
if os.getenv("HAPROXY_PASSWORD"):
|
||||||
|
password = os.getenv("HAPROXY_PASSWORD")
|
||||||
|
if password.startswith("/run/secrets/"): # support docker secrets
|
||||||
|
with open(password) as passfh:
|
||||||
|
password = passfh.read().strip()
|
||||||
result["stats"] = {
|
result["stats"] = {
|
||||||
"username": os.getenv("HAPROXY_USERNAME") if os.getenv("HAPROXY_USERNAME") else "admin",
|
"username": os.getenv("HAPROXY_USERNAME") if os.getenv("HAPROXY_USERNAME") else "admin",
|
||||||
"password": os.getenv("HAPROXY_PASSWORD"),
|
"password": password,
|
||||||
"port": os.getenv("HAPROXY_STATS_PORT") if os.getenv("HAPROXY_STATS_PORT") else "1936",
|
"port": os.getenv("HAPROXY_STATS_PORT") if os.getenv("HAPROXY_STATS_PORT") else "1936",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue