From cac39ebd2dae7f923ee95c94f473571cccdf0305 Mon Sep 17 00:00:00 2001
From: Konstantinos Natsakis <5933427+knatsakis@users.noreply.github.com>
Date: Fri, 9 Oct 2020 15:02:29 +0300
Subject: [PATCH] Rename NETDATA_PORT to NETDATA_LISTENER_PORT (#10045)

Because it clashes with a kubernetes defined NETDATA_PORT variable: Our Helm
chart creates a service called netdata which in turn makes kubernetes export a
NETDATA_PORT environment variable with a value like tcp://<ip>:19999 which is
not parsable by the netdata agent as a value to the `-p` argument.
---
 packaging/docker/Dockerfile | 4 ++--
 packaging/docker/run.sh     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile
index 475813b21a..9d0928b9ca 100644
--- a/packaging/docker/Dockerfile
+++ b/packaging/docker/Dockerfile
@@ -107,8 +107,8 @@ RUN \
 # Install any Python wheels
 RUN pip install /wheels/*
 
-ENV NETDATA_PORT 19999
-EXPOSE $NETDATA_PORT
+ENV NETDATA_LISTENER_PORT 19999
+EXPOSE $NETDATA_LISTENER_PORT
 
 ENTRYPOINT ["/usr/sbin/run.sh"]
 
diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh
index 8a2ed8c6c6..726f3849d5 100755
--- a/packaging/docker/run.sh
+++ b/packaging/docker/run.sh
@@ -19,6 +19,6 @@ if [ -n "${PGID}" ]; then
   usermod -a -G "${PGID}" "${DOCKER_USR}" || echo >&2 "Could not add netdata user to group docker with ID ${PGID}"
 fi
 
-exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_PORT}" -W set web "web files group" root -W set web "web files owner" root "$@"
+exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_LISTENER_PORT}" -W set web "web files group" root -W set web "web files owner" root "$@"
 
 echo "Netdata entrypoint script, completed!"