Skip to content

Commit

Permalink
add support for NC_HAPROXY_PASSWORD_FILE env variable
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
  • Loading branch information
bigcat88 committed Jun 11, 2024
1 parent 1a958cb commit 8f707e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ You should set `BIND_ADDRESS` to the IP on which server with ExApps can accept r

`TIMEOUT_SERVER`: timeout for ExApp to start responding to NC request, default: **30s**

`NC_HAPROXY_PASSWORD_FILE`: Specifies path to a file containing the password for HAProxy.

> [!NOTE]
> This file should be mounted into the container, and the password will be read from this file.
> If both NC_HAPROXY_PASSWORD and NC_HAPROXY_PASSWORD_FILE are specified, the container will exit with an error.

#### Only for ExApp installs with TLS:

* `EX_APPS_NET`: determines destination of requests to ExApps for HaProxy. Default:`localhost`
Expand Down
10 changes: 10 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/bin/sh

# Check if both NC_HAPROXY_PASSWORD and NC_HAPROXY_PASSWORD_FILE are specified
if [ -n "$NC_HAPROXY_PASSWORD" ] && [ -f "$NC_HAPROXY_PASSWORD_FILE" ]; then
echo "Error: Both NC_HAPROXY_PASSWORD and NC_HAPROXY_PASSWORD_FILE are specified. Please specify only one."
exit 1
fi

if [ -f "$NC_HAPROXY_PASSWORD_FILE" ]; then
NC_HAPROXY_PASSWORD=$(cat "$NC_HAPROXY_PASSWORD_FILE")
fi

sed -i "s|NC_PASSWORD_PLACEHOLDER|$NC_HAPROXY_PASSWORD|" /haproxy.cfg
sed -i "s|TIMEOUT_CONNECT|$TIMEOUT_CONNECT|" /haproxy.cfg
sed -i "s|TIMEOUT_CLIENT|$TIMEOUT_CLIENT|" /haproxy.cfg
Expand Down

0 comments on commit 8f707e4

Please sign in to comment.